Headers carry everything about a message that is not its content: who is calling (Authorization), what format the body is in (Content-Type), what format the client wants back (Accept), how long it may be cached (Cache-Control), which version it is (ETag) and when to try again (Retry-After). Names are case-insensitive; values are text.
A request or response is a start line, then headers one per line, then an empty line, then the body. Intermediaries read and add headers without touching the body — a proxy adds Via, a load balancer X-Forwarded-For, a CDN its own cache status. Many behaviours that look like API features are really header conventions.
That asserting on the body is enough. Some of the most consequential bugs live only in headers: a missing Location after a 201, a Cache-Control that lets a private response be cached by a CDN, a Content-Type of text/html on a JSON body. They pass every body assertion.
Every response in the docs panel shows its headers next to the body, and the assertion language reads them with headers.<name> — try headers.etag exists on GET /football/v1/standings.
All glossary terms · Testing techniques · All 39 mock REST APIs
Last updated