The Ultimate Guide to Formatting HTTP Request Bodies in Frontend: Understanding JSON, FormData, and x-www-form-urlencoded

The Ultimate Guide to Formatting HTTP Request Bodies in Frontend: Understanding JSON, FormData, and x-www-form-urlencoded

In actual frontend development, when interacting with backend APIs, have you ever been confused between <span>application/json</span>、<span>application/x-www-form-urlencoded</span> and <span>multipart/form-data</span>? This article will provide detailed code examples (using Fetch API and Axios) to thoroughly explain the differences, applicable scenarios, and practical applications of these three common Content-Types, allowing you to navigate the path of request body formatting … Read more

Who ‘Killed’ Your HTTP Connection?

Who 'Killed' Your HTTP Connection?

Hello everyone, I am Tony Bai. Have you encountered intermittent errors in a production environment such as <span>EOF</span>, <span>connection reset by peer</span>, or <span>unexpected end of stream</span>? Have you checked the code logic, firewall rules, or even captured packets, only to find that everything is normal at the application layer, yet requests occasionally fail? The … Read more

Differences and Implementation Principles of HTTP and HTTPS (Examples)

Differences and Implementation Principles of HTTP and HTTPS (Examples)

Core Differences and Implementation Principles of HTTP and HTTPS including technical details, parameter comparisons, and examples. 1. Core Differences Comparison Table Feature HTTP HTTPS Protocol Nature Hypertext Transfer Protocol (Plaintext Transmission) HTTP over SSL/TLS (Encrypted Transmission) Default Port 80 443 Transmission Security Data is exposed (can be eavesdropped/tampered) AES-256 and other encryptions (prevents man-in-the-middle attacks) … Read more

Beyond HTTP: A Comprehensive Guide to Application Layer Protocols

Beyond HTTP: A Comprehensive Guide to Application Layer Protocols

Application Layer Protocols DNS Protocol Main Function: Responsible for resolving domain names into IP addresses. What is a domain name: Root Domain: . Top-Level Domains: com, edu, net, cn, org, gov Second-Level Domains: baidu.com, 91xueit.com Third-Level Domains: dba.baidu.com, ftp.baidu.com Domain Name Resolution Test: Signal baidu.com nslookup www.baidu.com (CDN causes different resolution results) DHCP Protocol Main … Read more

Understanding the HTTP Protocol Through 23 Illustrations

Understanding the HTTP Protocol Through 23 Illustrations

Introduction to HTTP 1. HTTP Versions Since the invention of the HTTP protocol, it has undergone several version modifications, namely <span><span>HTTP/0.9</span></span>,<span><span>HTTP/1</span></span><span><span>.0</span></span>,<span><span>HTTP/1.1</span></span> and <span><span>HTTP/2</span></span>。Currently, the most widely used version is <span><span>HTTP/1.1</span></span>,which is the focus of this article. 2. TCP/IP Protocol Before learning about the HTTP protocol, let’s first understand the TCP/IP protocol. It serves as the … Read more

Analysis of Intermittent 502 Bad Gateway Errors in Client HTTP Access

Analysis of Intermittent 502 Bad Gateway Errors in Client HTTP Access

Reading Tip: This article is approximately 4094 words, reading time is 5 minutes 1. Fault Phenomenon When the client accesses the target website, it can normally access the external network and return a 200 status code during the initial connection establishment phase. However, subsequent client requests continuously encounter errors, receiving a 502 Bad Gateway error … Read more

What Happens to an HTTP Message When You Press Enter?

What Happens to an HTTP Message When You Press Enter?

In previous chapters, we learned the basic concepts of the HTTP protocol. Today, we will explore HTTP messages, using the analogy of mailing a letter to help you easily understand HTTP messages. Core Analogy: HTTP is Like Mailing a Letter Imagine you want to send a letter and a gift to a friend through the … Read more

Why Do We Need HTTP When We Have TCP? Understanding RPC Clearly This Time

Why Do We Need HTTP When We Have TCP? Understanding RPC Clearly This Time

I remember when I first started working and encountered the concept of RPC; I was filled with confusion—if HTTP works just fine, why create RPC? It wasn’t until I participated in several microservices projects that I truly understood the value of each. Today, let’s clarify the relationships between these protocols. Starting from Network Basics: The … Read more

Packaging MQTT into HTTP Requests in IoT

Packaging MQTT into HTTP Requests in IoT

In web development, we are accustomed to HTTP requests, while MQTT is relatively unfamiliar.Although it is possible to use MQTT on the web, it can be quite cumbersome.We first define the topic /request as the MQTT request and /response as the MQTT response, and then combine them into a single HTTP request.1. Building an MQTT … Read more