Unicodify the header name (key) as well as value#1346
Merged
Conversation
In Python 2 using a Headers object as so,
h = Headers()
h[b'X-Foo'] = b'something'
gives
X-Foo: something
in the actual HTTP message, whereas in Python 3 it is
b'X-Foo': something
this is because only the value is currently unicodified. This change
ensures the header name (key) is also unicodified as well therefore
matching the Python 2 usage and the expected usage.
This also removes a regression test for unicode header keys that is
not required. It was recognised in flask#758 as resulting in a HTTP
message containing,
u'X-Foo': something
however this behaviour was fixed in
f3435a3 introducing the test, broken
in 6049a4f and then comprehensively
fixed in db00dfb. Therefore with the
last commit and tests as added the regression test is not required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Python 2 using a Headers object as so,
gives
in the actual HTTP message, whereas in Python 3 it is
this is because only the value is currently unicodified. This change
ensures the header name (key) is also unicodified as well therefore
matching the Python 2 usage and the expected usage.
See also pallets/flask#1986
This also removes a regression test for unicode header keys that is
not required. It was recognised in pallets/flask#758 as resulting in a HTTP
message containing,
however this behaviour was fixed in f3435a3 introducing the test, broken
in 6049a4f and then comprehensively fixed in db00dfb. Therefore with the
last commit and tests as added the regression test is not required.