【nodejs】Node.js has no method 'sendHeader'

TypeError: Object #<ServerResponse> has no method 'sendHeader'
    at Server.<anonymous> (/home/suntiger036/javascript/nodejs/helloword.js:4:18)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2051:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:122:23)
    at Socket.socket.ondata (http.js:1940:22)
    at TCP.onread (net.js:510:27)
1 TypeError: Object #<ServerResponse> has no method 'close'
2     at Server.<anonymous> (/home/suntiger036/javascript/nodejs/helloword.js:6:18)
3     at Server.EventEmitter.emit (events.js:98:17)
4     at HTTPParser.parser.onIncoming (http.js:2051:12)
5     at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:122:23)
6     at Socket.socket.ondata (http.js:1940:22)
7     at TCP.onread (net.js:510:27)

解决办法:

response.writeHead()

 替换

response.sendHeader

response.end()

替换

response.close()
原文地址:https://www.cnblogs.com/sniper007/p/3135074.html