DELETE method passes the point of no return ?! #926
Replies: 2 comments 5 replies
-
Very poetic. Its not about delete, delete can return a value. Status code 204 does not support content. You can change the status to 200 or something else and return a value. Regarding other frameworks - you are welcome to try returning 204 with starlette and content and see what happens. Its simply that starlette and fastAPI default to 200 for delete, which is semantically wrong. |
Beta Was this translation helpful? Give feedback.
-
I was having a similar issue until I realized that it was returning the 204 status code. Is there a reason why 204 is being preferred over 200. I feel like a lot a lot of people (myself included) might be expected that the default be to return some sort of object about what was deleted during the method. Therefore a 200 might be the preferred expected result that users might think to use, with the status_code parameter allowing the 204 no-content body version. |
Beta Was this translation helpful? Give feedback.
-
It is impractical for real-life usage.
Starlette and FastApi allows DELETE method to return results:
https://sqlmodel.tiangolo.com/tutorial/fastapi/delete/
Aiohttp, Sanic and Quart allow DELETE method to return results too:
https://sanic.dev/en/guide/advanced/class-based-views.html#defining-a-view
https://subscription.packtpub.com/book/web-development/9781801076302/2/ch02lvl1sec11/how-quart-handles-requests
Because "results of DELETE return" save our extra codes. It make programs simple and direct to match with SQLAlchemy results:
Delete support the ability to return the number of rows matched after the statement proceeds
https://docs.sqlalchemy.org/en/20/tutorial/data_update.html#tutorial-multi-table-deletes
My main point is:
I request DELETE method of Starlite passing the point of some return, as same as other competitors
https://youtu.be/D-TgDvyr3g4?t=132
Beta Was this translation helpful? Give feedback.
All reactions