Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pbartlett-oi
Copy link
Contributor

While mocking a third party API, I came across issues where Headers would not match because the headers required were in Upper case.
This can be addressed in the http.Request by setting the map entries directly rather than having them sanitised when adding with http.RequestHeader.Add or http.Request.Header.Set.

The underlying code for the match already pulls the values from the map directly, but when the match is added, it uses Header.Set, meaning if I'm expecting a header like: "JANKY-UPPERCASE-HEADER" it will never match, because the matcher changes it to "Janky-Uppercase-Header".

This change allows this to be mocked as well. By setting the values to be matched explicitly to the Map when the Header Match is created.

This change also fixes issue #58

…headers, including UPPERCASE and Mixed-CASE headers. The current matching implementation does not allow for this. This change allows you to mock this type of header, but setting the headers explicitly to the map, rather than through set.
@h2non h2non merged commit 1ad1247 into h2non:master Nov 6, 2019
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.

2 participants