Anatomy of an HTTP Response

Rapid
Anatomy of an HTTP Response
Anatomy of an HTTP Response

The Anatomy of an HTTP Response.

Rapid
Anatomy of an HTTP Response
Anatomy of an HTTP Response

HTTP responses are made by a server in response to a client's request. They inform the client about whether the request was successful; if not, they provide error information. They also deliver resources to the client if that's what is requested. There are three components to an HTTP response.

Rapid
Anatomy of an HTTP Response
Anatomy of an HTTP Response

The first part is the status line. This displays the HTTP version in use, followed by an informative status code indicating how the server handled the request. For example, a '200 OK'code means the request was successful, '404' indicates the requested resource was not found, etc.

Rapid
Anatomy of an HTTP Response
Anatomy of an HTTP Response

The second part of a response is the HTTP response headers. There are various headers to provide extra information about a response. There are headers for security, content, caching, date and time details, and more.

Rapid
Anatomy of an HTTP Response
Anatomy of an HTTP Response

The last part of a response is the body(data). This part is optional, depending on the type of request sent. The body contains the data that is being sent back to the client. This could be an image, text, JSON, etc. In the response structure, there is always a blank line that precedes the body.

Rapid
Anatomy of an HTTP Response
Anatomy of an HTTP Response

An HTTP response fully constructed with its's three parts: The status, headers, and body.

Rapid
Anatomy of an HTTP Response
Anatomy of an HTTP Response

The server sends the response to the client as a reply to its request.