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"
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)
def redirect(self, url): if isinstance(url, unicode): url = url.encode("UTF-8") Request.redirect(self, url)