zoukankan      html  css  js  c++  java
  • 【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()
  • 相关阅读:
    Bootstrap的datetimepicker插件使用
    值得关注几个博客
    Windows下安装和配置tomca(免安装版本)
    AC自动机
    反向输出链表
    替换空格
    二维数组中的查找
    windows下配置nginx+php环境
    HTTP协议详解
    leetcode.3Sum
  • 原文地址:https://www.cnblogs.com/sniper007/p/3135074.html
Copyright © 2011-2022 走看看