Repository navigation
Commit 14f7e3e
fix: correct CORS allowed-methods/headers defaults (#34)
cors_allowed_methods and cors_allowed_headers defaulted to [""], a list
holding one empty string. That is not "allow all" (which needs "*") nor
empty — it made litestar's CORSConfig emit an empty
Access-Control-Allow-Methods on preflight, so a browser at the
configured dev origin (localhost:5173) had every preflighted write
(POST/PUT with JSON) blocked. allowed-headers likewise emitted a stray
leading-comma token.
Default both to ["*"] (permissive dev defaults; tighten via env in
prod). Add a preflight integration test asserting POST/PUT appear in
Access-Control-Allow-Methods through the real settings -> bootstrap ->
middleware path; it fails on the old [""] default.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c991b8a commit 14f7e3e
2 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments