patx/mrhttp-asgi

Add 3xx responses to the resp example

Commit 1704d48 · Mark · 2024-09-02T21:37:56-07:00

Changeset
1704d48e31889081a3065240f08ed186c939c476
Parents
0d4719d218db12950dad15fb67086d2912e04af6

View source at this commit

Comments

No comments yet.

Log in to comment

Diff

diff --git a/examples/4_response.py b/examples/4_response.py
index cec6097..1dfb091 100644
--- a/examples/4_response.py
+++ b/examples/4_response.py
@@ -39,11 +39,27 @@ def json(r):
 def mrp(r):
   return mrpacker.pack([1,2,3])
 
[email protected]('/301')
+def redirect301(r):
+  raise mrhttp.HTTPRedirect("/foo")
+  return 'Hello World!'
+
[email protected]('/303')
+def redirect303(r):
+  raise mrhttp.HTTPRedirect("/foo", 303)
+  return 'Hello World!'
+
+
 
 app.run(cores=2)
 
-# curl -i --raw 'http://localhost:8080/' -H "Cookie: mrsession=43709dd361cc443e976b05714581a7fb;"
+# curl -i --raw http://localhost:8080/ -H "Cookie: mrsession=43709dd361cc443e976b05714581a7fb;"
+
+# curl -i --raw http://localhost:8080/text
+# curl -i --raw http://localhost:8080/json
+# curl -i --raw http://localhost:8080/mrp
+# curl -i --raw http://localhost:8080/301
+# curl -i --raw http://localhost:8080/303
+
+
 
-# curl -i --raw 'http://localhost:8080/text'
-# curl -i --raw 'http://localhost:8080/json'
-# curl -i --raw 'http://localhost:8080/mrp'