Заголовок ставится, только там Teacherid становится
const fetch = require('node-fetch');
fetch('https://httpbin.org/delete', {
method: 'DELETE',
headers: {
"teacherId": 8
}
})
.then(res => res.text())
.then(text => {
console.log(text);
});
ответ
/usr/local/bin/node /Users/evgenij/projects/fetch.js
{
"args": {},
"data": "",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip,deflate",
"Host": "httpbin.org",
"Teacherid": "8",
"User-Agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
"X-Amzn-Trace-Id": "Root=1-5e99af90-fe7e43f7f3d1149a814fd762"
},
"json": null,
"origin": "*******",
"url": "https://httpbin.org/delete"
}