Why this matters
Correct semantics enable predictable client behavior and monitoring.
Return 2xx on success, 4xx for client errors, and 5xx for server errors with minimal, non-sensitive bodies.
Correct semantics enable predictable client behavior and monitoring.
Side-by-side examples engineers can pattern-match during review.
return Ok(new { error = "failed" });return StatusCode(StatusCodes.Status500InternalServerError, new { error = "internal_error" });return Ok(new { error="x" })return BadRequest(new { error="invalid" })From the same buckets as this rule.