Open netwjx opened 11 years ago
我也遇到了相同的问题,作者修复一下吧。
Hi Please let me know what's wrong in this me also facing same issue, "TypeError: first argument must be a string or Buffer"
app.get('/', function (req, res) {
var postData = querystring.stringify(coreRequest.coreRequestFormat());
// Here coreRequest.coreRequestFormat() it will return JSON Object.
var options = {
host: '192.168.1.86',
port: 8080,
path: '/coresoft-system-4.3.7/services/rest/handleRequest',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': postData
}
};
var req = http.request(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
// write data to request body req.write(postData); req.end(); }
错误发生在使用POST提交表单时,我看了下代码
/opt/node-v0.10.4/lib/node_modules/nproxy/lib/utils.js:47
调用来源于
/opt/node-v0.10.4/lib/node_modules/nproxy/lib/middlewares/responders/web-file.js:4
对于POST请求没有传
data