Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 3edb65c

Browse files
committed
Header keys should always be lower case.
I actually can't find anywhere in the standard that mandates this, but the static header table uses entirely lower-case keys. To avoid inefficiency in sending the headers, just force people to use lower-case versions.
1 parent d27113d commit 3edb65c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

hyper/http20/stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def add_header(self, name, value):
7878
"""
7979
Adds a single HTTP header to the headers to be sent on the request.
8080
"""
81-
self.headers.append((name, value))
81+
self.headers.append((name.lower(), value))
8282

8383
def send_data(self, data, final):
8484
"""

test/test_hyper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ def test_streams_can_have_headers(self):
838838
def test_stream_opening_sends_headers(self):
839839
def data_callback(frame):
840840
assert isinstance(frame, HeadersFrame)
841-
assert frame.data == 'TestKeyTestVal'
841+
assert frame.data == 'testkeyTestVal'
842842
assert frame.flags == set(['END_STREAM', 'END_HEADERS'])
843843

844844
s = Stream(1, data_callback, None, NullEncoder, None)

0 commit comments

Comments
 (0)