Known subclasses: twisted.web.test.test_agent.BrowserLikeRedirectAgentTests, twisted.web.test.test_agent.RedirectAgentTests

Test cases mixin for RedirectAgentTests and BrowserLikeRedirectAgentTests.

Method test_noRedirect client.RedirectAgent behaves like client.Agent if the response doesn't contain a redirect.
Method test_redirect301 client.RedirectAgent follows redirects on status code 301.
Method test_redirect302 client.RedirectAgent follows redirects on status code 302.
Method test_redirect307 client.RedirectAgent follows redirects on status code 307.
Method test_redirect303 client.RedirectAgent changes the method to GET when getting a 303 redirect on a POST request.
Method test_noLocationField If no Location header field is found when getting a redirect, client.RedirectAgent fails with a ResponseFailed error wrapping a error.RedirectWithNoLocation exception.
Method test_307OnPost When getting a 307 redirect on a POST request, client.RedirectAgent fails with a ResponseFailed error wrapping a error.PageRedirect exception.
Method test_redirectLimit If the limit of redirects specified to client.RedirectAgent is reached, the deferred fires with ResponseFailed error wrapping a InfiniteRedirection exception.
Method test_relativeURI client.RedirectAgent resolves and follows relative URIs in redirects, preserving query strings.
Method test_relativeURIPreserveFragments client.RedirectAgent resolves and follows relative URIs in redirects, preserving fragments in way that complies with the HTTP 1.1 bis draft.
Method test_relativeURISchemeRelative client.RedirectAgent resolves and follows scheme relative URIs in redirects, replacing the hostname and port when required.
Method test_responseHistory Response.response references the previous Response from a redirect, or None if there was no previous response.
Method _testRedirectDefault When getting a redirect, client.RedirectAgent follows the URL specified in the Location header field and make a new request.
Method _testRedirectToGet client.RedirectAgent changes the method to GET when getting a redirect on a non-GET request.
Method _testPageRedirectFailure When getting a redirect on an unsupported request method, client.RedirectAgent fails with a ResponseFailed error wrapping a error.PageRedirect exception.
Method _testRedirectURI When client.RedirectAgent encounters a relative redirect URI, it is resolved against the request URI before following the redirect.
def test_noRedirect(self):

client.RedirectAgent behaves like client.Agent if the response doesn't contain a redirect.

def _testRedirectDefault(self, code):

When getting a redirect, client.RedirectAgent follows the URL specified in the Location header field and make a new request.

ParameterscodeHTTP status code.
def test_redirect301(self):

client.RedirectAgent follows redirects on status code 301.

def test_redirect302(self):

client.RedirectAgent follows redirects on status code 302.

def test_redirect307(self):

client.RedirectAgent follows redirects on status code 307.

def _testRedirectToGet(self, code, method):

client.RedirectAgent changes the method to GET when getting a redirect on a non-GET request.

ParameterscodeHTTP status code.
methodHTTP request method.
def test_redirect303(self):

client.RedirectAgent changes the method to GET when getting a 303 redirect on a POST request.

def test_noLocationField(self):

If no Location header field is found when getting a redirect, client.RedirectAgent fails with a ResponseFailed error wrapping a error.RedirectWithNoLocation exception.

def _testPageRedirectFailure(self, code, method):

When getting a redirect on an unsupported request method, client.RedirectAgent fails with a ResponseFailed error wrapping a error.PageRedirect exception.

ParameterscodeHTTP status code.
methodHTTP request method.
def test_307OnPost(self):

When getting a 307 redirect on a POST request, client.RedirectAgent fails with a ResponseFailed error wrapping a error.PageRedirect exception.

def test_redirectLimit(self):

If the limit of redirects specified to client.RedirectAgent is reached, the deferred fires with ResponseFailed error wrapping a InfiniteRedirection exception.

def _testRedirectURI(self, uri, location, finalURI):

When client.RedirectAgent encounters a relative redirect URI, it is resolved against the request URI before following the redirect.

ParametersuriRequest URI.
locationLocation header redirect URI.
finalURIExpected final URI.
def test_relativeURI(self):

client.RedirectAgent resolves and follows relative URIs in redirects, preserving query strings.

def test_relativeURIPreserveFragments(self):

client.RedirectAgent resolves and follows relative URIs in redirects, preserving fragments in way that complies with the HTTP 1.1 bis draft.

See Alsohttps://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-7.1.2
def test_relativeURISchemeRelative(self):

client.RedirectAgent resolves and follows scheme relative URIs in redirects, replacing the hostname and port when required.

def test_responseHistory(self):

Response.response references the previous Response from a redirect, or None if there was no previous response.

API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.