mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Drop API token requirement from API explorer, refs #1871
This commit is contained in:
parent
f6bf2d8045
commit
9eb9ffae3d
2 changed files with 13 additions and 9 deletions
|
|
@ -131,3 +131,12 @@ def register_commands(cli):
|
|||
if debug:
|
||||
click.echo("\nDecoded:\n")
|
||||
click.echo(json.dumps(ds.unsign(token, namespace="token"), indent=2))
|
||||
|
||||
|
||||
@hookimpl
|
||||
def skip_csrf(scope):
|
||||
# Skip CSRF check for requests with content-type: application/json
|
||||
if scope["type"] == "http":
|
||||
headers = scope.get("headers") or {}
|
||||
if dict(headers).get(b"content-type") == b"application/json":
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue