fastapi (starlette) RedirectResponse redirect to post instead get method
When you want to redirect to a GET after a POST, the best practice is to redirect with a 303 status code, so just update your code to: # … return RedirectResponse(redirect_url, status_code=303) As you’ve noticed, redirecting with 307 keeps the HTTP method and body. Fully working example: from fastapi import FastAPI, APIRouter, Request from … Read more