React Native + fetch + API: DELETE request does not work in application, works in Postman

We have an API that we request through React Native.

GET, the POST request works flawlessly either in our application or in Postman.

DELETE does not work in the application, but the same request works with Postman.

What's even weirder:

If we delete the resource from Django or Postman, then the same request from our application on the phone will give us a 404 response, telling us that it really was deleted.

This means that a call from our application should work, as we get a response from the API!

So basically DELETE does not work from the application, but if we delete the resource from another place, it acts as if it actually works.

We tested it from two different phones, just in case ... And we use Expo.

Example of our DELETE request:

https: // apiurl / reservations / id_num {"method": "DELETE", "headers": {"Accept": "application / json", "Content-Type": "application / json", "X-App- Token ":" blablatoken "," Authorization ":" JWT blablasuperlongtoken "}}

UPDATE : The question asked by MattyK14 was good, we got a 200 response, which should be our GET answer. We explored this path, but cannot find anything.

We are rebuilding the API using Axios, since we cannot find anything, and we will check.

0
source share
1

!

URL- API. Django DELETE GET, . .

+1

Source: https://habr.com/ru/post/1686075/


All Articles