1. Armin Ronacher
  2. werkzeug-main

Commits

Ali Afshar  committed 89bbc5d

Correctly ascertain the response code in test.Client for redirects

  • Participants
  • Parent commits f910c13
  • Branches default

Comments (0)

Files changed (1)

File werkzeug/test.py

View file
  • Ignore whitespace
         if self.cookie_jar is not None:
             self.cookie_jar.extract_wsgi(environ, rv[2])
 
-        if rv[0].status_code in (301, 302, 303, 305, 307) and follow_redirects:
+        status_code = int(rv[1].split(None, 1)[0])
+        if status_code in (301, 302, 303, 305, 307) and follow_redirects:
             redirect = urlparse.urlunsplit(urlparse.urlsplit(
                 dict(rv[2])['Location'])[:-2] + ('', ''))
             kwargs.update({