Quiz Entry - updated: 2026.07.14
How is an HTTP response structured?
An HTTP response mirrors the request: a status line with the result code, then headers, a blank line, and finally the body — the actual HTML, JSON, or image.
Answering a request for a page, the server sends back text like this:
HTTP/1.1 200 OK <- status line
Date: Fri, 10 Sep 2021 07:10:47 GMT
Server: Apache/2.4.46 (Win64)
Last-Modified: Fri, 02 Oct 2020 10:41:20 GMT
Content-Length: 72
Content-Type: text/html
Connection: Keep-Alive
<- empty line
<!DOCTYPE html> <- response body
<html>
<body>
<p>Hello World</p>
</body>
</html>
The pieces:
| Part | Content |
|---|---|
| Status line | HTTP version, status code, status text (e.g. 200 OK) |
| Response headers | server info, caching directives (Server, Date) |
| Representation headers | describe the body — Content-Type, Content-Length |
| Empty line | separator between headers and body |
| Resource entity (body) | the actual payload: HTML, JSON, an image, ... |
Why the headers matter: Content-Type: text/html tells the browser to render the body as a page; change it to application/json and the same bytes are treated as data. Content-Length: 72 tells the receiver exactly how many bytes of body to expect.