根据文档,默认情况下应发送 Date 响应标头。
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 标题。怎么了?