节点中的http.get出错(PARSE ERROR)

时间:2017-06-26 16:44:12

标签: node.js parse-error

http.get({host:'192.168.2.104'},function(res){
console.log("test");
.
.

创建以下错误:

Error: Parse Error
at Error (native)
at Socket.socketOnData (_http_client.js:362:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:547:20)

来自服务器的卷曲响应:

root@kali:~# curl http://192.168.2.104 -v
* Rebuilt URL to: http://192.168.2.104/
*   Trying 192.168.2.104...
* TCP_NODELAY set
* Connected to 192.168.2.104 (192.168.2.104) port 80 (#0)
> GET / HTTP/1.1
> Host: 192.168.2.104
> User-Agent: curl/7.52.1
> Accept: */*
> 
* Curl_http_done: called premature == 0
* Connection #0 to host 192.168.2.104 left intact
{"uptime":4561488,"error":0,"temp":34.30,"humidity":28.60}

服务器非常简单,并且在HTTP响应中添加了NO HEADERS 无法找到解决方案

0 个答案:

没有答案