mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Docs + unit tests for Response, closes #821
This commit is contained in:
parent
f5e79adf26
commit
db660db463
4 changed files with 86 additions and 1 deletions
|
|
@ -405,6 +405,15 @@ class Response:
|
|||
content_type="text/plain; charset=utf-8",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def json(cls, body, status=200, headers=None):
|
||||
return cls(
|
||||
json.dumps(body),
|
||||
status=status,
|
||||
headers=headers,
|
||||
content_type="application/json; charset=utf-8",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def redirect(cls, path, status=302, headers=None):
|
||||
headers = headers or {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue