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()

相关文章:

  • 2022-12-23
  • 2021-04-01
  • 2021-07-19
  • 2021-07-14
  • 2022-12-23
  • 2021-12-21
  • 2022-01-13
  • 2021-09-27
猜你喜欢
  • 2022-01-30
  • 2021-05-16
  • 2021-11-05
  • 2021-11-20
  • 2021-06-28
  • 2021-09-06
  • 2022-12-23
相关资源
相似解决方案