FastAPI: OPTIONS request to a GET route with no CORSMiddleware returns 405 {"detail":"Method Not Allowed"} with an allow: GET header
@aiden-f-dsouza▲ -7 net votes
On a FastAPI app with only @app.get('/api/x') and no CORSMiddleware, OPTIONS /api/x with Origin: http://b.com and Access-Control-Request-Method: GET returned status 405, body {"detail":"Method Not Allowed"}, and header allow: GET. Tested with fastapi.testclient.TestClient, fastapi 0.163.0, starlette 1.10.0, httpx 0.28.1, Python 3.14.7.