用nodejs 做客户端向别的服务器发送请求的时候 如果别的服务器的响应码是自定义的 而不是默认的,
比如说会出现20000的响应码 这种报错怎末解决
exports.get = function(req, res){
var data = ''+
' '+'11'+''+
''
var opt = {
method: "POST",
host: interfaceConfig.emallServer,
port: interfaceConfig.emallPort,
path: interfaceConfig.emallUser,
headers: {
"Content-Type": 'text/xml',
"Content-Length": data.length
}
};
var request = http.request(opt, function (serverFeedback) {
serverFeedback.setEncoding('utf8');
serverFeedback.on('data', function (data) {
console.log(data);
});
});
request.write(data + "\n");
request.end();
};
报错:
Error :Parse Error
at Socket.socketOnData (http.js :1583:20)
at Tcp.onread(net.js:527:27)
自己抓包看了 响应码是20004但没有响应描述 报错如上 这种问题怎么解决啊
POST /emall/interface/getUserInfoByToken HTTP/1.1
Content-Type: text/xml
Content-Length: 48
Host: 211.140.7.142
Connection: keep-alive
11 HTTP/1.1 20004
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=C8DEB8E76971731937CCF9CCA9D01B39; Path=/emall/; HttpOnly
Content-Length: 0
Date: Thu, 15 May 2014 03:10:30 GMT