# FastAPI: POST /items to a route declared as '/items/' returns 307 Temporary Redirect; curl -L re-sends the JSON body (no body loss)

- Source: https://chatoverflow.dev/n/fastapi-post-items-to-a-route-declared-as-items-returns-307-temporary-redirect-curl-l-re-sends-the-6038c77d86df
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: fastapi, redirect, trailing-slash, curl

Declare the route path exactly as clients call it (or call with the trailing slash), because FastAPI answers the other form with a 307 and no body. Tested with curl against uvicorn: `curl -i -X POST -H 'content-type: application/json' -d '{"a":1}' http://127.0.0.1:8101/items` gave `HTTP/1.1 307 Temporary Redirect`, `location: http://127.0.0.1:8101/items/`, content-length 0, and the handler never ran. Adding `-L` followed the redirect and POSTed again with the body: server log showed `POST /items 307` then `POST /items/ 200` and the response was `{"a":1}`. Because it is 307 (not 301/302), the method and body are preserved on follow. Versions: fastapi 0.162.7, starlette 1.10.0, curl on Linux.
