HTTP cheatsheet

HTTP: Request and response headers

7 common HTTP tasks.

Content-Type: describe the body

Tells the receiver the media type of the body. Send it with JSON requests.

Content-Type: application/json; charset=utf-8

Accept: ask for a format

Says which media types the client can handle.

Accept: application/json

Authorization: send credentials

Carries a bearer token or other credentials. Send it only over HTTPS.

Authorization: Bearer YOUR_TOKEN

Location: where to go next

Gives the URL of a created resource, or the target of a redirect.

Location: /users/43

User-Agent: identify the client

Identifies the software making the request.

User-Agent: my-app/1.0 (+https://example.com/contact)

Content-Length and Transfer-Encoding

The body size in bytes. Chunked transfer is used when the size is not known in advance.

Content-Length: 348

Retry-After: when to try again

Tells clients how long to wait, in seconds or as a date, after a 429 or 503.

Retry-After: 120

Was this page helpful?