mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Test illustrating POST against register_routes(), closes #853
This commit is contained in:
parent
a4ad5a504c
commit
d2aef9f7ef
2 changed files with 14 additions and 0 deletions
|
|
@ -162,10 +162,17 @@ def register_routes():
|
|||
send, {"hello": "world"}, status=200, headers={"x-three": "1"}
|
||||
)
|
||||
|
||||
async def post(request):
|
||||
if request.method == "GET":
|
||||
return Response.html(request.scope["csrftoken"]())
|
||||
else:
|
||||
return Response.json(await request.post_vars())
|
||||
|
||||
return [
|
||||
(r"/one/$", one),
|
||||
(r"/two/(?P<name>.*)$", two),
|
||||
(r"/three/$", three),
|
||||
(r"/post/$", post),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue