Menu

When a 200 Response Still Breaks the Contract
📰

When a 200 Response Still Breaks the Contract

DEV Community: api·Jeff·8 days ago
#X21mOz7m
#devtoapi#devto#dev#contract#status
Reading 0:00
15s threshold

Quick answer: A 200 status only means the request was accepted and returned a response. It does not confirm the body matches the contract, so a wrong field, a bad type, or a missing value can break the spec while the status stays green. Assert the response fields and check them against the schema, and keep contract evidence separate from the status code so a 200 cannot mask drift.

Why status and contract are different checks

The HTTP status lives at the transport layer. It answers whether the call succeeded, was rejected, or hit an error. The contract lives at the schema layer and answers whether the response shape and values match what the spec declares.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.