为什么requestify.request()崩溃,因为它认为它没有得到方法POST
var postBody = querystring.stringify(dat);
var postOptions = {
host: 'https://www.example.com'
, path: '/admin'
, method: 'post' // POST, 'POST', post
, headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postBody) }
};
var postReq = requestify.request(postOptions, function (err, resp, respBody) {
resp.setEncoding('utf8');
resp.on('data', function (chunk) {
console.log('Response: ' + chunk);
});
});发布于 2017-04-09 18:57:47
看起来您使用的是新版本的requestify文档的旧版本。
阅读API reference部分的https://github.com/ranm8/requestify
然后再往下读,看到一个requestify.request()示例。
选项没有host,path,.
https://stackoverflow.com/questions/43310644
复制相似问题