feat: Implementation of RFC9457 #6835
Open
+42
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
Http1.x has a reasonPhrase for conveying extra information about the reason for a given status code. This was often useful for adding additional context for why a response has failed, for example a generic 403 status code can have many interpretations.
Http2 onwards no longer has reasonPhrase as part of the protocol and as such is difficult to convey additional context.
RFC9457 adds the ability to convey this information as part of the body, indicated using a header 'application/problem+json'
There is prior art in client tools, see the recent maven implementation here
...
How did you fix it?
There is a customPackageError call the determines if any unique messaging should be part of the response. Here I check for the existence of the 'application/problem+json' header, if the header exists and there is valid json body then a RFC9457 report is generated.
Example output:
...
Checklist