Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/test_cors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from typing import TYPE_CHECKING


if TYPE_CHECKING:
from httpx import AsyncClient


async def test_cors_preflight_allows_write_methods(client: AsyncClient) -> None:
response = await client.options(
"/api/decks/",
headers={
"Origin": "http://localhost:5173",
"Access-Control-Request-Method": "POST",
},
)

allow_methods = response.headers.get("access-control-allow-methods", "")
assert "POST" in allow_methods
assert "PUT" in allow_methods