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
This commit is contained in:
Brian Bamsch
2016-09-25 21:50:29 -07:00
parent 439451c3d4
commit b28531f4bb
+10
View File
@@ -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 = {