1. The problem
In one sentence
The spec marks a response header as required, and the server does not send it.
A story
A list screen needs to show “page 1 of 12”. The spec says every answer carries an X-Total-Count header with the number of records. The server was refactored, the line that sets the header was lost, and now it answers 200 with the right body and no header. The screen shows “page 1 of NaN”.
Why it hurts
Headers carry information that is not in the body: counts, rate limits, cache rules, pagination links. A client that relies on a required header gets null or an error, and the body alone looks fine.
- For developers: the code path that sets headers is easy to lose in refactors, and body-only tests do not see it.
- For managers: a feature (paging, caching, rate-limit display) quietly stops working. No error is raised on the server.
- For DevOps: gateways and proxies can strip or rename headers. Run the check through the same path clients use.
Example
The spec fragment:
responses:
"200":
headers:
X-Total-Count:
description: Number of records
required: true
schema: { type: integer, minimum: 0 }
The response:
HTTP/1.1 200 OK
content-type: application/json
{"id": 1, "name": "Alpha", "price": 9.99}
There is no x-total-count line.
How to detect it without clrsig
curl -i URLand look for the header.curl -sI URL | grep -i x-total-countprints nothing when it is missing.
How to fix it
There are two usual causes:
- The code is wrong (more likely). The header is not set on this path (an early return, an error branch, a cache hit). Set it on every path that returns this response.
- The spec is wrong. The header is only sometimes available. Then make it optional (
required: false) so the contract tells the truth.
To tell which: ask whether clients depend on it. If a client needs it every time, the code is wrong. Never silence the check.
Related problems
AC-004 A response header has the wrong type, AC-002 Wrong Content-Type, AC-005 A required field is missing from the body.
Words used on this page are explained once in the glossary.
2. How clrsig helps
Check
CS-RESP-003 Required response header not sent. State: caught. Severity today: failure (exit code 1).
Command
--paths limits the run to this one GET, so nothing is written:
clrsig conform specs/contract-fail.yaml \
-b http://localhost:8080/contract-fail \
--env clrsig/environments/contract-fail.yaml \
--paths /cases/resp-003-missing-required-header --explain
Exit code: 0 clean, 1 a finding, 2 the spec or the setup is broken. Here it is 1.
What you see
Output from clrsig v0.21.0, recorded on 2026-11-30. The lines for the 36 operations that --paths skipped are left out by grep -v '^ SKIP'; no line is edited.
contract-fail API 1.0.0
Base URL: http://localhost:8080/contract-fail
Limited by --paths /cases/resp-003-missing-required-header
FAIL GET /cases/resp-003-missing-required-header 200 15ms
✗ GET /cases/resp-003-missing-required-header 200: the response header "X-Total-Count" is required by the spec but was not sent
→ [CS-RESP-003] The required header "X-Total-Count" was not sent. Why: The spec marks the "X-Total-Count" header of response 200 as required, but the server's response did not include it. The body was not compared with the schema. Where: response header "X-Total-Count" (spec: GET /cases/resp-003-missing-required-header → response 200 → headers → X-Total-Count). Fix: Send "X-Total-Count" from the server, or make it optional (or remove it) in the spec.
FAILED 37 operations · 0 passed · 1 failed · 36 skipped 17ms
How to read it: the header name, the response status it belongs to, and the path in the spec. It also says the body was not compared.
Where to look
- Desktop app: Check Conformance shows the failure under “missing header”. Help, What We Check lists
CS-RESP-003. - Reports: with
--format json, the finding carries"checkId": "CS-RESP-003". - GitHub Action: it runs the same command.
How clrsig helps you fix it
It names the header, the response and the spec path, and offers both fixes. It cannot tell you whether clients depend on the header.
Limits
- The body is not compared when a required header is missing. Fix the header, then run again to see body problems.
- The
schemaassertion in a scenario ignores headers; use aheaderassertion, or run the step with a spec. - A header the spec never mentions is not reported (
CS-GAP-003).
More ways
Nothing yet.