人们,使用put
库尝试needle.js
以下对象:
var object = {
fName: 'Jasmine',
lName: 'Tests'
}
var options = {
json: true,
accept: 'application/json'
}
needle.put(url, object, options, function (err, resp, body) {
if (err) {
console.log ('post error',err);
callback (err, null);
} else {
console.log ("RETURNED", body)
callback (null, resp, body);
}
})
我回来了:
RETURNED { code: 'InternalError', message: 'Unexpected token o' }
Express API尝试对传入的请求执行JSON.parse()
并失败。有什么建议吗?
谢谢!