Solution 1 :

No there isn’t. Apart from GET and POST requests, most of the other HTTP method serve only semantic purposes. Except for some notable examples such as OPTIONS which is use to communicate supported methods. Using correct HTTP verbs will make your application / API easier to understand.

The same goes for HTTP status code. Functionality-wise, it doesn’t really matter if you send a 200 (OK), 201(Created), or 202 (Accepted) for a successful request. However, sending the correct status code can avoid necessary confusion.

Solution 2 :

As far as I know, no. There’re no hazards of using HTTP post method instead of DELETE. You can see how it’s used in deletion here

Solution 3 :

One difference is that users might be tricked into making the POST request and inadvertently deleting an entry, if they are lured onto a malicious web page that contains an auto-submitting HTML form

<form method="POST" action="<your deletion endpoint>">

(Whether that is possible depends on the content type that your deletion endpoint expects.)

A DELETE request, however, cannot be forged in such a way. A malicious web page could create a DELETE request only with fetch or XMLHttpRequest, and because of the CORS protocol the browser would refuse to carry that out (unless your server explicitly allows it through a suitable CORS preflight response).

Problem :

I’m creating a TODO list app with nodejs and I need an option to delete a todo record. So I’ve created an HTML form that contains a delete button but I can only use POST as the method. actually my code is working fine but are there any problems with using POST to DELETE records?


Comment posted by Aviv Lo

So does it explained your questions?

Comment posted by Kedar K

If any more doubts about Django/DRF/MERN, you can ask me without hesistation


Leave a Reply

Your email address will not be published. Required fields are marked *