DRF instance page sends GET instead of DELETE with both Firefox and Chromium

15 views
Skip to first unread message

Olivier

unread,
Apr 21, 2020, 3:27:07 AM4/21/20
to Django users
Hello,

I'm discovering DRF.
When I type http://foo/api/friends/3/ in my browser, I'm seeing content describing Friend 2 or Friend 3 instance.

When I type curl -X DELETE http://foo/api/friends/2/ a DELETE request is sent to my Django app and everything works OK as Friend 2 is removed from database.

When looking at Friend 3 instance, I can see a DELETE and a Delete buttons.
When I click over DELETE then Delete buttons, a GET request is sent over to my Django instance.
I would expect a DELETE request to be sent.

I tried this with both Firefox 68 ESR and Chromium 57 and with both a GET request is sent instead of a DELETE one.
I also tried with PATCH button: a GET request is also sent.

Looking at this HTTP request capture, I do not see any evidence reflecting a DELETE or PATCH intent.
Looking at page HTML source code, I can see that buttons are mapped to GET request with an intriguing "data-method" set to DELETE or PATCH.


1. Is it possible to have these browsers sending expected DELETE or PATCH requests ?
Is it something that can be configured by Django ? Within browsers themselves ?

2. Is it possible to have these browsers still sending GET request but have my Django app mapping these requests to the DELETE/PATCH/whatever
methods these requests are supposed to be mapped to ?


Best regards
Reply all
Reply to author
Forward
0 new messages