mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
--cors Access-Control-Allow-Headers: Authorization
Refs #1467, refs https://github.com/simonw/datasette-auth-tokens/issues/4
This commit is contained in:
parent
0fdbf00484
commit
8584993529
7 changed files with 20 additions and 11 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import hashlib
|
||||
import json
|
||||
|
||||
from datasette.utils import check_visibility, CustomJSONEncoder
|
||||
from datasette.utils import add_cors_headers, check_visibility, CustomJSONEncoder
|
||||
from datasette.utils.asgi import Response
|
||||
from datasette.version import __version__
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ class IndexView(BaseView):
|
|||
if as_format:
|
||||
headers = {}
|
||||
if self.ds.cors:
|
||||
headers["Access-Control-Allow-Origin"] = "*"
|
||||
add_cors_headers(headers)
|
||||
return Response(
|
||||
json.dumps({db["name"]: db for db in databases}, cls=CustomJSONEncoder),
|
||||
content_type="application/json; charset=utf-8",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue