:param **kwargs: Optional arguments that ``request`` takes.
"""
+ if "allow_redirects" not in kwargs:
+ kwargs["allow_redirects"] = True
+
return request('get', url, **kwargs)
:param **kwargs: Optional arguments that ``request`` takes.
"""
+ if "allow_redirects" not in kwargs:
+ kwargs["allow_redirects"] = True
+
return request('head', url, **kwargs)
while (
('location' in r.headers) and
- ((self.method in ('GET', 'HEAD')) or
- (r.status_code is codes.see_other) or
+ ((r.status_code is codes.see_other) or
(self.allow_redirects))
):
r = requests.get(httpbin('/'))
self.assertEqual(r.status_code, 200)
+ def test_HTTP_302_ALLOW_REDIRECT_GET(self):
+ r = requests.get(httpbin('redirect', '1'))
+ self.assertEqual(r.status_code, 200)
+
+ def test_HTTP_302_GET(self):
+ r = requests.get(httpbin('redirect', '1'), allow_redirects=False)
+ self.assertEqual(r.status_code, 302)
def test_HTTPS_200_OK_GET(self):
r = requests.get(httpsbin('/'))