feat(http/unstable): add RFC 9457 Problem Details response helpers#7033
feat(http/unstable): add RFC 9457 Problem Details response helpers#7033bartlomieju merged 5 commits intodenoland:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7033 +/- ##
=======================================
Coverage 94.38% 94.39%
=======================================
Files 628 629 +1
Lines 50178 50255 +77
Branches 8840 8867 +27
=======================================
+ Hits 47360 47437 +77
Misses 2251 2251
Partials 567 567 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kt3k
left a comment
There was a problem hiding this comment.
Mostly looks good to me. Thanks for the suggestion. Left one minor suggestion
bartlomieju
left a comment
There was a problem hiding this comment.
Good RFC 9457 implementation — clean generics, solid type validation per §3.1, and thorough tests. A few things:
- Missing PR description. Should explain what RFC 9457 is and why it belongs in
@std/http. parseProblemDetails(response)consumes the body. Callingresponse.json()means the body can't be re-read. Worth documenting this explicitly, since callers may not expect it.isProblemDetailsResponse()only handles JSON. RFC 9457 also definesapplication/problem+xml. Fine to skip for now, but worth noting as a known limitation in the JSDoc.normalizeParsedProblemDetailsusesfor...inwithObject.hasOwnguard.Object.keys()orObject.entries()would be more idiomatic and avoid the need for the hasOwn check.
I attempted a new PR title and added PR desciption
Added a comment explaining this in the latest commit.
Added a comment explaining this in the latest commit.
That would work equally well. The |
Adds
@std/http/unstable-problem-details, a module for working with RFC 9457 – Problem Details for HTTP APIs.RFC 9457 defines a standard JSON (and XML) format for machine-readable error responses from HTTP APIs. It is widely adopted across REST ecosystems and replaces the earlier RFC 7807. Having first-class support in
@std/httpgives Deno users a consistent, spec-compliant way to produce and consume structured error payloads without pulling in third-party libraries.