-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Gracefully handle missing headers #1810
Conversation
Adds a failing test for missing Content-Encoding header that should result in an empty-list Content-Encoding instead of an error.
Reports a missing header rejection only if the header's decoder didn't return a default value. Closes tokio-rs#1781.
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 good!
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.
If @davidpdrsn agrees, I think we can merge this as a non-breaking change.
This avoids relying on Debug representation of the opaque ContentEncoding type.
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 good to me! Wanna update the change log as well?
Done. |
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!
Reports a missing header rejection only if the header's decoder didn't return a default value.
I've also added a regression test by using Cookie as an example: missing Cookie should be treated in the same way as empty Cookie header, but before this PR would reject the entire request. Now it's going to be handled correctly.
Closes #1781.