1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6const assert = require('assert'); 7const http2 = require('http2'); 8 9const server = http2.createServer(); 10 11server.on('stream', common.mustCall((stream) => { 12 // Date header is defaulted 13 stream.respond(); 14 stream.end(); 15})); 16 17server.listen(0, common.mustCall(() => { 18 const client = http2.connect(`http://localhost:${server.address().port}`); 19 const req = client.request(); 20 req.on('response', common.mustCall((headers) => { 21 // The date header must be set to a non-invalid value 22 assert.notStrictEqual((new Date()).toString(), 'Invalid Date'); 23 })); 24 req.resume(); 25 req.on('end', common.mustCall(() => { 26 server.close(); 27 client.close(); 28 })); 29})); 30