Browse Source

add 'Authorization' header to the test_cors/test_tutorial001.py

pull/14115/head
Flavius Raducu 9 months ago
parent
commit
c91067adc0
Failed to extract signature
  1. 2
      docs_src/cors/tutorial001.py
  2. 7
      tests/test_tutorial/test_cors/test_tutorial001.py

2
docs_src/cors/tutorial001.py

@ -15,7 +15,7 @@ app.add_middleware(
allow_origins=origins,
allow_credentials=True,
allow_methods=["GET"],
allow_headers=["X-Example"],
allow_headers=["Authorization", "X-Example"],
)

7
tests/test_tutorial/test_cors/test_tutorial001.py

@ -18,10 +18,11 @@ def test_cors():
response.headers["access-control-allow-origin"]
== "https://localhost.tiangolo.com"
)
expected_headers = (
"Accept, Accept-Language, Content-Language, Content-Type, X-Example"
assert response.headers["access-control-allow-headers"] == (
"Accept, Accept-Language, "
"Authorization, Content-Language, "
"Content-Type, X-Example"
)
assert response.headers["access-control-allow-headers"] == expected_headers
# Test standard response
headers = {"Origin": "https://localhost.tiangolo.com"}

Loading…
Cancel
Save