full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

Better HTTP error codes

Open machadoug opened this issue 5 years ago • 2 comments

It's better to use 401 for lack of permission and 409 if the user already exists https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409

machadoug avatar Aug 20 '20 11:08 machadoug

Seems like a stale PR. Could that be closed now?

menkotoglou avatar May 10 '24 13:05 menkotoglou

This branch is way behind main and OP hasn't acted on the suggestions, but the problem still persists:

Should be status_code=409

https://github.com/tiangolo/full-stack-fastapi-template/blob/a7f4d7dd61efd079f067a1f0da0dfebb80838bb4/backend/app/api/routes/users.py#L58-L62

Should be status_code=409

https://github.com/tiangolo/full-stack-fastapi-template/blob/a7f4d7dd61efd079f067a1f0da0dfebb80838bb4/backend/app/api/routes/users.py#L154-L158

~~Should be `status_code=403~~ (fixed in 541dd75ce97f61c07cb7b7331fb71d84712b6d65)

https://github.com/tiangolo/full-stack-fastapi-template/blob/a7f4d7dd61efd079f067a1f0da0dfebb80838bb4/backend/app/api/routes/users.py#L174-L178

codespearhead avatar May 10 '24 13:05 codespearhead