summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2_localnet.py
diff options
context:
space:
mode:
authorAlix Lourme <alix.lourme@gmail.com>2022-04-14 02:19:16 (GMT)
committerGitHub <noreply@github.com>2022-04-14 02:19:16 (GMT)
commit325d6f50357474c7d9fd2475be0e2481f7ae0476 (patch)
tree1f8facc03e5706824c667b64413ede8587fed241 /Lib/test/test_urllib2_localnet.py
parent5f056acdf28662e773ec5fe27db47ccad0e7671f (diff)
downloadcpython-325d6f50357474c7d9fd2475be0e2481f7ae0476.zip
cpython-325d6f50357474c7d9fd2475be0e2481f7ae0476.tar.gz
cpython-325d6f50357474c7d9fd2475be0e2481f7ae0476.tar.bz2
gh-87497: Document that urllib.request sends headers in camel case (GH-24661)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/test/test_urllib2_localnet.py')
-rw-r--r--Lib/test/test_urllib2_localnet.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index 3631431..f472935 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -617,6 +617,15 @@ class TestUrlopen(unittest.TestCase):
pass
self.assertEqual(handler.headers_received["Range"], "bytes=20-39")
+ def test_sending_headers_camel(self):
+ handler = self.start_server()
+ req = urllib.request.Request("http://localhost:%s/" % handler.port,
+ headers={"X-SoMe-hEader": "foobar"})
+ with urllib.request.urlopen(req):
+ pass
+ self.assertIn("X-Some-Header", handler.headers_received.keys())
+ self.assertNotIn("X-SoMe-hEader", handler.headers_received.keys())
+
def test_basic(self):
handler = self.start_server()
with urllib.request.urlopen("http://localhost:%s" % handler.port) as open_url: