Media type of the body, optionally with a charset.
Content-Type: application/json; charset=utf-8
What to test
Assert responses declare the right type (application/json, application/problem+json for errors). Send requests with a wrong or missing Content-Type and expect 415. Error pages from proxies often come back as text/html.
Check export endpoints set attachment with a sensible filename, non-ASCII names use filename*, and user-supplied names cannot inject quotes or path separators.
Send Accept: application/xml to a JSON-only API: expect 406 or documented fallback. Versioned media types (application/vnd.example.v2+json) should select the right version.
Credentials for the request (Basic, Bearer, etc.).
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9...
What to test
Test missing, malformed, expired and wrong-audience tokens (expect 401), and valid tokens lacking scope (expect 403). Make sure the header is not logged and not forwarded on cross-host redirects.
Responses with personal data or tokens must be no-store (or at least private). Public, cacheable resources should have a deliberate max-age. Check CDN behaviour matches.
Must not blindly reflect any Origin when credentials are allowed. "*" cannot be combined with credentials. Include Vary: Origin when the value depends on the request.
If the frontend reads Location, ETag or rate limit headers, they must be exposed; otherwise they appear null in the browser even though curl shows them.
Session cookies need Secure, HttpOnly and SameSite (Lax or Strict). SameSite=None requires Secure. Check Max-Age/Expires, Domain scope, and that logout clears the cookie.
Current remaining quota and reset time for a policy. IETF draft.
RateLimit: "default";r=42;t=30
What to test
Remaining (r) should decrease by one per request and the reset (t) should count down. Older drafts used separate RateLimit-Limit/-Remaining/-Reset headers.
Send a known trace id from your test and confirm it appears in the tracing backend, linking test failures to server traces. Malformed values must be ignored, not cause errors.
Retry the same request with the same key: one side effect, same response. Same key with a different body: expect 422 (or 409). Check how long keys are remembered.
Original client IP and protocol as seen by proxies.
X-Forwarded-For: 203.0.113.7, 10.0.0.2
What to test
Send a spoofed value directly and check rate limiting, IP allow-lists and audit logs do not trust it from untrusted hops.
RFC 7239 (Forwarded); X-Forwarded-For is de-facto
Sobre esta ferramenta
Os headers carregam boa parte do comportamento de uma API: regras de cache, locking otimista, permissões de CORS, segurança de cookies, rate limits e trace ids. Esta referência lista perto de sessenta headers que aparecem em testes de API, cada um com direção, finalidade, um exemplo realista, o que testar e a especificação que o define. Headers que ainda são drafts do IETF, como RateLimit, RateLimit-Policy e Idempotency-Key, são marcados como draft porque a sintaxe ainda pode mudar; convenções muito usadas sem RFC, como X-Request-Id e X-RateLimit-*, são marcadas como padrão de fato.
Como usar
Busque um header ou um tema como “cors”, “cookie” ou “cache”.
Filtre por direção (requisição ou resposta) ou por categoria.
Copie a linha de exemplo para a sua requisição ou use a nota “O que testar” como ideia de assertion. Cada header tem um link âncora.
Perguntas frequentes: Referência de headers HTTP
Por que o curl vê um header de resposta e meu código no navegador não?
JavaScript cross-origin só consegue ler headers de resposta na safelist do CORS, a menos que o servidor liste outros em Access-Control-Expose-Headers. Location, ETag e headers customizados costumam ficar de fora dessa lista.
Quais headers de segurança uma API JSON deve enviar?
No mínimo Strict-Transport-Security em HTTPS e X-Content-Type-Options: nosniff, além de Cache-Control: no-store em respostas com dados pessoais ou tokens. Uma Content-Security-Policy restritiva é um reforço extra barato. Evite expor versões em Server e X-Powered-By.
Os nomes de headers diferenciam maiúsculas de minúsculas?
Não. Os nomes de campos de header HTTP não diferenciam maiúsculas de minúsculas, e HTTP/2 e HTTP/3 os enviam em minúsculas. Escreva assertions que comparem nomes sem diferenciar maiúsculas; a maioria dos clientes, incluindo response.headers() do Playwright, normaliza para minúsculas.