url = '%s:%s' % (parsed_rurl.scheme, url)
# The scheme should be lower case...
- scheme, uri = url.split('://')
- url = '%s://%s' % (scheme.lower(), uri)
+ if '://' in url:
+ scheme, uri = url.split('://', 1)
+ url = '%s://%s' % (scheme.lower(), uri)
# Facilitate non-RFC2616-compliant 'location' headers
# (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')
headers['ACCEPT'.encode('ascii')],
'application/json'
)
+ def test_uppercase_scheme(self):
+ r = requests.get('HTTP://example.com/')
+ self.assertEqual(r.status_code, 200)
def test_transport_adapter_ordering(self):
s = requests.Session()
self.assertEqual(frozenset(cid), keyset)
+
+ def test_uppercase_scheme_redirect(self):
+ r = requests.get(httpbin('redirect-to'), params={'url': 'HTTP://example.com/'})
+
+
if __name__ == '__main__':
unittest.main()