Access-Control-Allow-Headers: Authorization, Content-Type - refs #1922

pull/1930/head
Simon Willison 2022-11-30 15:11:16 -08:00
rodzic 418eb7c5c6
commit f0fadc28dd
3 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -1129,7 +1129,7 @@ async def derive_named_parameters(db, sql):
def add_cors_headers(headers):
headers["Access-Control-Allow-Origin"] = "*"
headers["Access-Control-Allow-Headers"] = "Authorization"
headers["Access-Control-Allow-Headers"] = "Authorization, Content-Type"
headers["Access-Control-Expose-Headers"] = "Link"
headers["Access-Control-Allow-Methods"] = "GET, POST, HEAD, OPTIONS"

Wyświetl plik

@ -13,7 +13,7 @@ If you started Datasette with the ``--cors`` option, each JSON endpoint will be
served with the following additional HTTP headers::
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Expose-Headers: Link
Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS

Wyświetl plik

@ -912,7 +912,7 @@ def test_cors(
response = app_client_with_cors.get(path)
assert response.status == status_code
assert response.headers["Access-Control-Allow-Origin"] == "*"
assert response.headers["Access-Control-Allow-Headers"] == "Authorization"
assert response.headers["Access-Control-Allow-Headers"] == "Authorization, Content-Type"
assert response.headers["Access-Control-Expose-Headers"] == "Link"
assert (
response.headers["Access-Control-Allow-Methods"] == "GET, POST, HEAD, OPTIONS"