HTTP Messages

This section will cover the HTTP messaging system, including how messages are structured and how they are used to communicate between clients and servers. We will also discuss the different types of messages and their purposes.

What is the HTTP messaging cycle?

HTTP consists of two types of messages: a request and response. These messages occur in a cycle called the request-response cycle.

request-response cycle

Request

The cycle starts with a client sending an HTTP request to the server. In order to make a request, it must contain a URL, HTTP method, headers, and a request body.

According to freecodedcamp.org, “A request contains information about the requested source and other parameters.” After the server receives the client’s request, it must process it before sending a response back to the client.

Headers

Headers carry additional information about a request or a response, and have a name/value format.

Response

An HTTP response consists of a status line, headers, and a message body.

Once the client receives the message, it renders the content and displays it using either a web browser or a web application.

Status Line

According to cloudfare.com , the status line consists of a status code that indicates the outcome of the request and a corresponding message. An example of a status code users commonly run into is the “404 not found” error. There are five different status code blocks: informational (1xx), success (2xx), redirection (3xx), client error (4xx), and server error (5xx) (Jain, n.d.). The “xx” are numbers between 00 and 99 (HTTP/2 to Origin · Cloudflare Speed Docs, 2025).