HTTP Request
A method, URL, headers and an optional body.
Also known as: HTTP request message, request line, request headers
An HTTP request is the message a client sends to a server. It has four parts.
POST /orders?source=web HTTP/1.1
Host: api.example.com
Content-Type: application/json
Authorization: Bearer eyJhbGciOi...
Accept: application/json
{"item_id": 7, "quantity": 2}
| Part | Example | Meaning |
|---|---|---|
| Request line | POST /orders?source=web HTTP/1.1 | the method, the path and query, and the protocol version |
| Headers | Host, Content-Type, Authorization | metadata about the request (headers) |
| Blank line | separates headers from the body | |
| Body (optional) | {"item_id": 7 ...} | data being sent (body) |
The full address comes from the Host header plus the path (and the scheme and port you connected with) (URLs).
What each part is for
- Method: what to do (
GETread,POSTcreate…). - Path: which resource (
/orders/917). - Query string: optional parameters, such as filters and paging (query strings).
- Headers: who you are, what you send and accept, caching hints, cookies.
- Body: the payload for
POST,PUTandPATCH.
Seeing real requests
curl -v https://example.com # shows the request it sends
The network tab in browser DevTools lists every request, with headers and bodies.
Points to remember
- A
GETnormally has no body. - Header names are case-insensitive.
- Cookies travel in the
Cookieheader. - Everything in a request is controlled by the client, so the server must validate it (never trust the client).
- HTTP/2 and HTTP/3 carry the same information in a binary form.
The reply is an HTTP response.