Skip to content

feat: Implementation of RFC9457 #6835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

doddi
Copy link

@doddi doddi commented Jun 28, 2025

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:

➤ YN0035: │   RFC9457: "{\"status\":403,\"title\":\"Component Report\",\"detail\":\"Requested item has been blocked, FOR DETAILS SEE ------>>> http://localhost:8070/component-report/NWJiMWMyN2EzZjVjNDYxYWE2NWY0ODk3NDAxNWVjMDY <<<------\"}"

...

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@doddi doddi force-pushed the feat-incorporate-rfc9457-for-error-messaging branch from b386466 to 677b1ed Compare June 28, 2025 08:46
@doddi doddi changed the title Implementation of RFC9457 feat: Implementation of RFC9457 Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant