mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
- fixed func call syntax on lower to lower()
- added test cases for trying to test GETS on mixed-case schemas
This commit is contained in:
@@ -118,7 +118,7 @@ class HTTPAdapter(BaseAdapter):
|
||||
:param verify: Whether we should actually verify the certificate.
|
||||
:param cert: The SSL certificate to verify.
|
||||
"""
|
||||
if url.lower.startswith('https') and verify:
|
||||
if url.lower().startswith('https') and verify:
|
||||
|
||||
cert_loc = None
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ class Session(SessionRedirectMixin):
|
||||
"""Returns the appropriate connnection adapter for the given URL."""
|
||||
for (prefix, adapter) in self.adapters.items():
|
||||
|
||||
if url.lower.startswith(prefix):
|
||||
if url.lower().startswith(prefix):
|
||||
return adapter
|
||||
|
||||
# Nothing matches :-/
|
||||
|
||||
@@ -87,6 +87,27 @@ class RequestsTestCase(unittest.TestCase):
|
||||
self.assertEqual(request.url,
|
||||
"http://example.com/path?key=value&a=b#fragment")
|
||||
|
||||
def test_mixed_case_scheme_acceptable(self):
|
||||
s = requests.Session()
|
||||
r = requests.Request('GET', 'HTTP://httbin.org/get')
|
||||
r = s.send(r.prepare())
|
||||
self.assertEqual(r.status_code,200)
|
||||
r = requests.Request('GET', 'hTTp://httbin.org/get')
|
||||
r = s.send(r.prepare())
|
||||
self.assertEqual(r.status_code,200)
|
||||
r = requests.Request('GET', 'HttP://httbin.org/get')
|
||||
r = s.send(r.prepare())
|
||||
self.assertEqual(r.status_code,200)
|
||||
r = requests.Request('GET', 'HTTPS://httbin.org/get')
|
||||
r = s.send(r.prepare())
|
||||
self.assertEqual(r.status_code,200)
|
||||
r = requests.Request('GET', 'hTTps://httbin.org/get')
|
||||
r = s.send(r.prepare())
|
||||
self.assertEqual(r.status_code,200)
|
||||
r = requests.Request('GET', 'HttPs://httbin.org/get')
|
||||
r = s.send(r.prepare())
|
||||
self.assertEqual(r.status_code,200)
|
||||
|
||||
def test_HTTP_200_OK_GET_ALTERNATIVE(self):
|
||||
r = requests.Request('GET', httpbin('get'))
|
||||
s = requests.Session()
|
||||
|
||||
Reference in New Issue
Block a user