Incorrect HTTP Status and Business-Error Semantics
HTTP 200 returned when a business operation was rejected; consumers misinterpret failures as success.
Failure explanation
An API’s HTTP status code contradicts the actual outcome represented by the body or business state. Returning 200 for a rejected payment, failed transfer, or invalid operation can cause generated clients, monitoring, and consumers to record false success. Conversely, returning an error status after a committed operation can encourage unsafe retries. Status semantics and business outcome must be designed together.
Example
POST /transfers returns HTTP 200 with {"result":"REJECTED","reason":"ACCOUNT_CLOSED"}. A client checks only the 2xx status and marks the transfer as successful.
How to test
- Exercise success, validation rejection, authentication failure, authorization failure, conflict, not-found, throttling, and server failure.
- Compare HTTP status, body code, and resulting business state.
- Simulate a committed operation followed by a lost response.
- Validate generated-client interpretation where practical.
Expected behavior
HTTP status and response body communicate a consistent outcome under the API’s chosen semantics. Negative tests assert the correct error rather than treating every non-2xx response as a test failure.
Runnable examples
- FM-025-01 incorrect-status
- FM-025-02 auth-error-code
- FM-025-03 redirect-instead-of-response
- FM-025-04 validation-error-code
- FM-025-05 empty-result-404
- FM-025-06 page-out-of-range-500
Each example includes a broken server, a fixed server, an OpenAPI spec, and a clrsig scenario that detects the failure.
Learn how to find and fix it
- AC-001 The server answers a status the spec never listed
- AC-019 A redirect that never ends
- AC-031 A request without credentials is accepted
- AC-032 Wrong, expired or under-privileged credentials are accepted
- AC-034 The wrong HTTP status for a business error
- AC-035 Authentication error codes are mixed up