Python: Model redirects in twisted

This commit is contained in:
Rasmus Wriedt Larsen
2021-06-08 16:16:56 +02:00
parent a21039170b
commit 23f668f8ee
2 changed files with 30 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ class PlainText(Resource):
class Redirect(Resource):
def render_GET(self, request: Request): # $ requestHandler
request.redirect("/new-location") # $ MISSING: HttpRedirectResponse
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"