Pcornel
Automation · APIs

Request Headers

Cheat sheet · https://pcornel.dk/topic.php?topic=5301

Back to the Topic

Answer

Metadata sent with an API request such as content negotiation, authorization, conditional state, tracing and client context.

Remember

  • Header present ≠ header honored; proxies, gateways or server policy may strip or override it.
  • Authorization header ≠ authorization granted; token validity and policy evaluation remain separate.
  • Content-Type ≠ payload valid; it only declares representation format.
  • Client-supplied tracing header ≠ trustworthy identity; correlation and security identity must remain distinct.

First checks

  • curl -v <url> 2>&1 | grep '^>' — request headers sent
  • Content-Type and Accept — formats
  • User-Agent identifying the automation — traceability

Verify in this order

client headers → server interpretation

Where it usually breaks

A request header proves caller intent only; server or intermediary handling determines its actual effect.

Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.

Request Headers API boundary map

BoundaryHealthy evidenceSuspicious evidence
Caller / requestEnvironment/version, identity and exact request contract are attributableHidden defaults, wrong endpoint/version, leaked or mismatched credentials
Server / responseStatus, headers, structured body and request ID are interpreted togetherStatus-only handling, ignored error body, ambiguous async result or unsafe retry
State / proofWrite result is reconciled with resource read-back or acceptance testResponse success treated as final target success without verification
TroubleshootingFirst failed boundary is preserved, changed minimally and retestedBlind retries, credential rotation, replay or payload edits before evidence is captured

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5301

Confirmation

Confirm action

Continue?