Quiz Entry - updated: 2026.07.14
How is an HTTP request structured?
An HTTP request is plain text: a request line naming the method, path and version, then header lines, then a blank line, then an optional body.
When you load a page, the browser sends something like this in readable text:
GET /hello.html HTTP/1.1 <- request line
Host: example.org <- headers begin
User-Agent: Mozilla/5.0 ...
Accept: text/html,application/xhtml+xml
Accept-Language: de,en-US;q=0.9
Accept-Encoding: gzip, deflate
Connection: keep-alive
<- empty line separates headers from body
[request body - optional] <- e.g. data for a POST
The pieces:
| Part | Content | Example |
|---|---|---|
| Request line | method, path, HTTP version | GET /page HTTP/1.1 |
| Request headers | metadata about the request | Host: example.org |
| Representation headers | the format being sent/wanted | Accept: text/html |
| Empty line | the separator | |
| Request entity (body) | data, optional | form fields for a POST |
The method in the request line declares intent:
GET— retrieve a resource (no body needed).POST— send data to create something (uses the body).PUT— replace / update a resource.DELETE— remove a resource.
Gotcha: that blank line is mandatory — it is how the server knows the headers ended and the body (if any) begins.
Go deeper:
HTTP messages (MDN) — annotated anatomy of the start-line, headers, blank line and body, for both requests and responses.