What do the five HTTP status-code families communicate, and why is a successful code not enough?
Answer
1xx is informational, 2xx success, 3xx redirection, 4xx client-side request failure and 5xx server failure. Tests must also check the specific code, response contract, cache behaviour and whether the intended state change occurred.
Strong answer includes
- all five families
- specific code semantics
- checks state beyond status
Practical example
A test only checks that a DELETE call returns 2xx and passes, but the API actually returned 202 Accepted instead of 204 No Content while the resource was still deleted asynchronously in the background; a stricter assertion on the exact code plus a follow-up GET would have caught the eventual-consistency gap.