Ejemplo n.º 1
0
 def extract_wsgi(self, environ, headers):
     """Extract the server's set-cookie headers as cookies into the
     cookie jar.
     """
     self.extract_cookies(
         _TestCookieResponse(headers),
         U2Request(get_current_url(environ)),
     )
Ejemplo n.º 2
0
 def fix_headers(self, environ):
     """This is automatically called right before the response is started
     and should fix common mistakes in headers.  For example location
     headers are joined with the root URL here.
     """
     if 'Location' in self.headers:
         self.headers['Location'] = urlparse.urljoin(
             get_current_url(environ, root_only=True),
             self.headers['Location']
         )
Ejemplo n.º 3
0
 def fix_headers(self, environ):
     """
     This is automatically called right before the response is started
     and should fix common mistakes in headers.  For example location
     headers are joined with the root URL here.
     """
     if 'Location' in self.headers:
         self.headers['Location'] = urlparse.urljoin(
             get_current_url(environ, host_only=True),
             self.headers['Location']
         )
Ejemplo n.º 4
0
 def fix_headers(self, environ):
     """This is automatically called right before the response is started
     and should fix common mistakes in headers.  For example location
     headers are joined with the root URL here.
     """
     if 'Location' in self.headers:
         self.headers['Location'] = urlparse.urljoin(
             get_current_url(environ, root_only=True),
             self.headers['Location']
         )
     if 100 <= self.status_code < 200 or self.status_code == 204:
         self.headers['Content-Length'] = 0
     elif self.status_code == 304:
         remove_entity_headers(self.headers)
Ejemplo n.º 5
0
 def host_url(self):
     """Just the host with scheme."""
     return get_current_url(self.environ, host_only=True)
Ejemplo n.º 6
0
 def url_root(self):
     """The full URL root (with hostname), this is the application root."""
     return get_current_url(self.environ, True)
Ejemplo n.º 7
0
 def base_url(self):
     """Like `url` but without the querystring"""
     return get_current_url(self.environ, strip_querystring=True)
Ejemplo n.º 8
0
 def url(self):
     """The reconstructed current URL"""
     return get_current_url(self.environ)
Ejemplo n.º 9
0
 def host_url(self):
     """Just the host with scheme."""
     return get_current_url(self.environ, host_only=True)
Ejemplo n.º 10
0
 def url_root(self):
     """The full URL root (with hostname), this is the application root."""
     return get_current_url(self.environ, True)
Ejemplo n.º 11
0
 def base_url(self):
     """Like `url` but without the querystring"""
     return get_current_url(self.environ, strip_querystring=True)
Ejemplo n.º 12
0
 def url(self):
     """The reconstructed current URL"""
     return get_current_url(self.environ)