tl;dr; Sending below curl works but I cannot do the same in supertest (what wrap superagent https://github.com/visionmedia/superagent/)
curl 'http://local/api/items' -X DELETE -H 'Accept-Encoding: gzip, deflate' -H 'content-type: application/json;charset=UTF-8' --data-binary '"1234"'
I can do delete item from web interface where I attach file with required text.
Then using dev tools I extracted curl command presented above and this works as a charm.
How to execute it in js?
Tried:
const response = yield request('http://local')
.delete('/api/items')
.set('Accept-Encoding', 'gzip, deflate')
.set('Content-Type', 'application/json;charset=UTF-8')
.send("1234");
Then I get
"status":400,"error":"BodyNotReadable",
Maybe using write
can be an answer but I don't know how to do that.
Full list of available options https://github.com/visionmedia/superagent/blob/master/lib/node/index.js