-1

I'm trying to send a Delete request using Fetch. I get a response status - OK, but data is null. However the request has a body with an object, but I'm unable to see it back in the data received from the request. Here is a sample code.

let myObj = {
    test: test1
}

fetch(deleteUrl, {
        method: 'DELETE',
        headers: {
            "Content-type": "application/json;charset=UTF-8"
        },
        body: JSON.stringify(myObj)
    }).then(
        response => response.json()
    ).then(function(data) {
        console.log(data) // Here the data is always null, but I want to log the request body(myObj)
    })
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335

1 Answers1

0

From my limited understanding of "fetch", you seem to looking at the response data, not the request data.

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98