From b28531f4bb43b401e3e37e2da622aee21002e5b2 Mon Sep 17 00:00:00 2001 From: Brian Bamsch Date: Sun, 25 Sep 2016 21:50:29 -0700 Subject: [PATCH] Add test for request when Host header is bytestring Request should successfully set cookie in response, fail if cookie fails to set as will occur in current state when cookie set tries lookup of domain --- tests/test_requests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_requests.py b/tests/test_requests.py index eaaf90c1..b6e8b99e 100755 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -858,6 +858,16 @@ class TestRequests: prep = s.prepare_request(req) assert prep.url == "https://httpbin.org/" + def test_request_with_bytestring_host(self): + s = requests.Session() + resp = s.request( + 'GET', + 'http://httpbin.org/cookies/set?cookie=value', + allow_redirects=False, + headers={'Host': b'httpbin.org'} + ) + assert resp.cookies.get('cookie') == 'value' + def test_links(self): r = requests.Response() r.headers = {