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

Unicodify the header name (key) as well as value #1346

Merged
merged 1 commit into from Nov 22, 2018

Conversation

Projects
None yet
2 participants
@pgjones
Copy link
Member

commented Aug 25, 2018

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.

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,

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.

@pgjones pgjones force-pushed the pgjones:headers branch from 0cc3b47 to 75001d1 Aug 26, 2018

@davidism davidism force-pushed the pgjones:headers branch from 75001d1 to 42c6d29 Nov 22, 2018

@davidism davidism added this to the 0.15 milestone Nov 22, 2018

Unicodify the header name (key) as well as value
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.

@davidism davidism force-pushed the pgjones:headers branch from 42c6d29 to 2ac855e Nov 22, 2018

@davidism davidism merged commit 962746d into pallets:master Nov 22, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.