可能会让我想到调试下面的代码片段。如何调试nodejs中的request.post
var request = require('request');
function sendINFO() {
var jsonString = {
reportType: 'customer',
comment: customerDetails.cust_id,
imageUrl: customerDetails.url1
}
console.log('json string', jsonString)
request.post(
'http://52.7.0.131/SendInfo/XC1K1AZ9', {
json: jsonString
},
function(error, response, body) {
console.log('response after adding report', response, 'error', error)
if (!error && response.statusCode == 200) {
console.log(body)
}
}
);
}
我想检查它是否正常工作。以及如何与邮差API测试这个
非常感谢您的帮助
在邮递员打http://52.7.0.131/SendInfo/XC1K1AZ9这个URL与方法作为POST和发送jsonString数据原始的身体和格式为JSON – AJS
我不明白你在说什么。 我只是做了这样的52.7.0.131/AddReport/FC5E1BF6' ,{JSON:jsonString} 后来我选择了生,还有我给像下面 VAR jsonString = { REPORTTYPE: '顾客', 评论:为CustomerDetails。 cust_id, imageUrl:customerDetails.url1 } – kimi
经过我的回答,低于 – AJS