Skip to content
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

Http header field names must be case-insensitive #762

Merged
merged 3 commits into from
Mar 31, 2020

Conversation

bitwiseman
Copy link
Member

@bitwiseman bitwiseman commented Mar 31, 2020

Description

GitHub has started changing their headers from capitalized words to all lowercase.
A recent change made the header fields querying case-senstive which broke gzip content detection.
This was not caught by tests because recorded files remain unchanged.
It is also possible that WireMock is auto-capitalizing.

This fixes the case-sensitivity issue and also extends that funcionality to anyone consuming the
headers generated by ResponseInfo.

This adds an additional Map construction for each response and getting the value of a header field is slightly slower (TreeMap instead of HashMap).

Fixes #751

@skaldarnar @jdrueckert @tomakehurst
If you can build this locally and verify this truly fixes the issue, that would be great.

Before submitting a PR:

We love getting PRs, but we hate asking people for the same basic changes every time.

  • Push your changes to a branch other than master. Create your PR from that branch.
  • Add JavaDocs and other comments
  • Write tests that run and pass in CI. See CONTRIBUTING.md for details on how to capture snapshot data.
  • Run mvn -D enable-ci clean install site locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.

GitHub has started changing their headers from capitalized words to all lowercase.
A recent change made the header fields querying case-senstive which broke gzip content detection.
This was not caught by tests because recorded files remain unchanged.
It is also possible that WireMock is auto-capitalizing.

This fixes the case-sensitivity issue and also extends that funcionality to anyone consuming the
headers generated by ResponseInfo.

Fixes hub4j#751
@tomakehurst
Copy link

My test passes with this fix 👍

@bitwiseman bitwiseman merged commit bfd9023 into hub4j:master Mar 31, 2020
@bitwiseman bitwiseman deleted the task/insensitive branch March 31, 2020 14:38
@skaldarnar
Copy link
Contributor

Thanks for the support and the quick fix @bitwiseman @tomakehurst 👍 highly appreciated!

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.

Decoding errror with content-encoding 'gzip'
3 participants