0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-25 08:19:38 +01:00
nodejs/test/parallel/test-http-date-header.js

35 lines
797 B
JavaScript
Raw Normal View History

2012-02-19 00:01:35 +01:00
var common = require('../common');
var assert = require('assert');
2012-02-19 00:01:35 +01:00
var http = require('http');
2012-02-19 00:01:35 +01:00
var testResBody = 'other stuff!\n';
var server = http.createServer(function(req, res) {
2012-02-19 00:01:35 +01:00
assert.ok(! ('date' in req.headers),
'Request headers contained a Date.');
res.writeHead(200, {
2012-02-19 00:01:35 +01:00
'Content-Type': 'text/plain'
});
res.end(testResBody);
});
server.listen(common.PORT);
2012-02-19 00:01:35 +01:00
server.addListener('listening', function() {
var options = {
port: common.PORT,
2012-02-19 00:01:35 +01:00
path: '/',
method: 'GET'
};
var req = http.request(options, function(res) {
assert.ok('date' in res.headers,
'Response headers didn\'t contain a Date.');
res.addListener('end', function() {
server.close();
process.exit();
});
2012-12-13 16:47:33 +01:00
res.resume();
});
req.end();
});