Ejemplo n.º 1
0
 def render_GET(self, request: Request):  # $ requestHandler
     request.redirect(
         "/new-location"
     )  # $ HttpRedirectResponse redirectLocation="/new-location" HttpResponse mimetype=text/html
     # By default, this `hello` output is not returned... not even when
     # requested with curl.
     return b"hello"  # $ SPURIOUS: HttpResponse mimetype=text/html responseBody=b"hello"
Ejemplo n.º 2
0
def respond_with_redirect(request: Request, url: bytes) -> None:
    """Write a 302 response to the request, if it is still alive."""
    logger.debug("Redirect to %s", url.decode("utf-8"))
    request.redirect(url)
    finish_request(request)
Ejemplo n.º 3
0
 def redirect(self, url):
     if isinstance(url, unicode):
         url = url.encode("UTF-8")
     Request.redirect(self, url)
Ejemplo n.º 4
0
 def redirect(self, url):
     if isinstance(url, unicode):
         url = url.encode("UTF-8")
     Request.redirect(self, url)