Junior — Middle
What components make up the structure of an HTTP response?
sobes.tech AI
Answer from AI
An HTTP response consists of three main components:
-
Status Line — contains the HTTP protocol version, status code (e.g., 200, 404), and a textual description of the status (e.g., OK, Not Found).
-
Headers — a set of key-value pairs that convey meta-information about the response, such as content type (
Content-Type), content length (Content-Length), date, and other parameters. -
Body — the actual data sent by the server to the client, such as an HTML page, JSON, image, etc.
Example of an HTTP response structure:
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 138
<html>
<body>
<h1>Hello, world!</h1>
</body>
</html>