diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-08-31 02:46:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-30 19:46:37 -0500 |
| commit | 24e540fb1ee8e127d7d3a354c6fa50c22e61ed11 (patch) | |
| tree | c43174aa3a446c4e1a2aa88370fb57b38722d3ed /test/with_dummyserver | |
| parent | 5a2101864b6bc7bad7dd3a97ba9312d4654b2872 (diff) | |
| download | urllib3-24e540fb1ee8e127d7d3a354c6fa50c22e61ed11.tar.gz | |
Coerce values to str in HTTPHeaderDict.__getitem__
Diffstat (limited to 'test/with_dummyserver')
| -rw-r--r-- | test/with_dummyserver/test_connectionpool.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/with_dummyserver/test_connectionpool.py b/test/with_dummyserver/test_connectionpool.py index 289ac664..18ce0c3e 100644 --- a/test/with_dummyserver/test_connectionpool.py +++ b/test/with_dummyserver/test_connectionpool.py @@ -853,6 +853,14 @@ class TestConnectionPool(HTTPDummyServerTestCase): assert no_ua_headers["User-Agent"] == SUPPRESS_USER_AGENT assert pool_headers.get("User-Agent") == custom_ua + def test_bytes_header(self): + with HTTPConnectionPool(self.host, self.port) as pool: + headers = {"User-Agent": b"test header"} + r = pool.request("GET", "/headers", headers=headers) + request_headers = json.loads(r.data.decode("utf8")) + assert "User-Agent" in request_headers + assert request_headers["User-Agent"] == "test header" + class TestRetry(HTTPDummyServerTestCase): def test_max_retry(self): |
