0
Я пытаюсь использовать Суперагент для отправки обновления в запись mongoDB. Я передаю _id объекта в URL-адресе, но я не могу передать новые данные супер агенту.Невозможно передать данные в запрос PUT
put: (url,body,callback) => { // Api.put('/api/polls/' + pollId,data
console.log('put ' + url); // path is here
console.log('obj ' + body); // data is here
superagent
.put(url)
.set('Content-Type', 'application/json')
.send(body)
.end((err, response) => {
if (err) {
console.log(err);
callback(err, null);
return;}
// here check for API failures
const confirmation = response.body.confirmation;
if (confirmation != 'success') {
// send a failure message
callback({message:response.body.message, null});
return;
}
callback(response, response.body);
})
},
`` ` См проблема Superagent.put вызова ... ничего в данных