2 Commits

Author SHA1 Message Date
Miguel Quintero
e08d632300 feat(gin): add ProblemDetails middleware rendering Context errors as RFC 9457
ProblemDetails() renders errors attached via Context.Error as an RFC 9457
problem details JSON response when the handler chain finishes without
writing a response. The response status code is kept when it is an error
status, otherwise it defaults to 500 Internal Server Error.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 16:43:58 -04:00
Miguel Quintero
7b9d081d7c feat(render): add RFC 9457 problem details JSON response support
Add first-class support for RFC 9457 "Problem Details for HTTP APIs"
error responses in JSON format:

- gin.Problem type with the standard members (type, title, status,
  detail, instance) and extension members serialized at the top level
- render.ProblemJSON renderer setting Content-Type to
  "application/problem+json; charset=utf-8"
- Context.ProblemJSON and Context.AbortWithProblemJSON helpers; when
  given a gin.Problem, a zero Status defaults to the response code and
  an empty Title defaults to http.StatusText

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 16:10:11 -04:00