-
Notifications
You must be signed in to change notification settings - Fork 919
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
Provide RequestHeaders
to ServerErrorHandler
#4037
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @trustin!
core/src/main/java/com/linecorp/armeria/server/DefaultServerErrorHandler.java
Outdated
Show resolved
Hide resolved
6c2c7c4
to
12626aa
Compare
Motivation: A user sometimes wants to generate an error response differently depending on a certain request header value. For example: - Include a certain request header value in an error response for easier troubleshooting; or - Provide a different level of detail for the requests that contain a certain header. Modifications: - Added an optional `RequestHeaders` parameter to `ServerErrorHandler` methods. - Modified `Http{1,2}RequestDecoder` so it constructs a `RequestHeaders` as early as possible, so that `ServerErrorHandler` is given with a non-null `RequestHeaders` in most cases. - Updated `CustomServerErrorHandlerTest` to demonstrate this feature. Result: - (new feature) A user can generate an error response differently depending on the request headers. - (breaking changes) The method signatures of `ServerErrorHandler` has been changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @trustin!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you @trustin ! 👍 🙇 👍
Motivation:
A user sometimes wants to generate an error response differently
depending on a certain request header value. For example:
troubleshooting; or
a certain header.
Modifications:
RequestHeaders
parameter toServerErrorHandler
methods.
Http{1,2}RequestDecoder
so it constructs aRequestHeaders
as early as possible, so that
ServerErrorHandler
is given with anon-null
RequestHeaders
in most cases.CustomServerErrorHandlerTest
to demonstrate this feature.Result:
depending on the request headers.
ServerErrorHandler
hasbeen changed.