response.writeHead and response.end in NodeJs

后端 未结 5 1592
予麋鹿
予麋鹿 2020-12-25 10:59
var https = require(\'https\');
var fs = require(\'fs\');

var options = {
  key: fs.readFileSync(\'test/fixtures/keys/agent2-key.pem\'),
  cert: fs.readFileSync(\'t         


        
5条回答
  •  遥遥无期
    2020-12-25 11:29

    response.writeHead(200) sends a response header to the request. The status code is a 3-digit HTTP status code, like 404.

    This method must only be called once on a message and it must be called before response.end() is called.

    If you call response.write() or response.end() before calling this, the implicit/mutable headers will be calculated and call this function for you.

提交回复
热议问题