You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing problem constructors for common statuses (Unauthorized, Forbidden, Conflict, Unprocessable, Internal) #16
problem_helpers.go ships ProblemBadRequest/NewBadRequestProblem and ProblemNotFound/NewNotFoundProblem, but nothing for the other statuses that come up just as often in a typical API:
401 Unauthorized
403 Forbidden
409 Conflict
422 Unprocessable Entity
500 Internal Server Error
Without these, every call site falls back to the fully manual httpsuite.NewProblemDetails(status, type, title, detail) — which is exactly the 4-argument ceremony the NewBadRequestProblem/NewNotFoundProblem helpers exist to avoid for those two statuses.
Measured impact in one consumer (GolgiMed, ~150k LOC): 845 manual NewProblemDetails(...) calls, of which ~730 are exactly the canonical (status, "unauthorized", "Unauthorized", detail) / (status, "forbidden", "Forbidden", detail) / etc. shape that a NewUnauthorizedProblem(detail) / NewForbiddenProblem(detail) would collapse to one line.
Activity