node.js 0.8中没有日期响应头

时间:2012-07-13 10:36:39

标签: http node.js

根据documentation日期响应标头应默认发送。

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

卷曲上面的样本我得到:

C:\Users\Hans>curl localhost:1337 -i
HTTP/1.1 200 OK
Content-Type: text/plain
Connection: keep-alive
Transfer-Encoding: chunked

Hello World

没有日期标题。即使我设置response.sendDate = true,我也没有Date标头。有什么问题?

1 个答案:

答案 0 :(得分:0)

从0.8.1升级到0.8.2现在可行了

C:\Users\Hans>curl localhost:1337 -i
HTTP/1.1 200 OK
Content-Type: text/plain
Date: Fri, 13 Jul 2012 10:52:59 GMT
Connection: keep-alive
Transfer-Encoding: chunked

Hello World