API Testing · Middle · Question 25 of 75
What should an error response for invalid input look like?
- 1A consistent format with a code, message and the problem fields
- 2An empty body, because the status code says enough
- 3A plain HTML page that contains the server stack trace
Show the answer
Correct answer: A consistent format with a code, message and the problem fields
Explanation
Formats like RFC 9457 problem details make errors predictable for clients and easy to assert in tests.