Пример #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)),
     )
Пример #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']
         )
Пример #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']
         )
Пример #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)
Пример #5
0
 def host_url(self):
     """Just the host with scheme."""
     return get_current_url(self.environ, host_only=True)
Пример #6
0
 def url_root(self):
     """The full URL root (with hostname), this is the application root."""
     return get_current_url(self.environ, True)
Пример #7
0
 def base_url(self):
     """Like `url` but without the querystring"""
     return get_current_url(self.environ, strip_querystring=True)
Пример #8
0
 def url(self):
     """The reconstructed current URL"""
     return get_current_url(self.environ)
Пример #9
0
 def host_url(self):
     """Just the host with scheme."""
     return get_current_url(self.environ, host_only=True)
Пример #10
0
 def url_root(self):
     """The full URL root (with hostname), this is the application root."""
     return get_current_url(self.environ, True)
Пример #11
0
 def base_url(self):
     """Like `url` but without the querystring"""
     return get_current_url(self.environ, strip_querystring=True)
Пример #12
0
 def url(self):
     """The reconstructed current URL"""
     return get_current_url(self.environ)