mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
f5102fbcf4
The `sendDate` flag was not being respected by the current implementation and the `Date` header was being sent regardless of the config. This commit fixes that and adds tests for this case. Fixes: https://github.com/nodejs/node/issues/34841 PR-URL: https://github.com/nodejs/node/pull/34850 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
27 lines
744 B
JavaScript
27 lines
744 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) { common.skip('missing crypto'); }
|
|
const assert = require('assert');
|
|
const http2 = require('http2');
|
|
|
|
const server = http2.createServer(common.mustCall((request, response) => {
|
|
response.sendDate = false;
|
|
response.writeHead(200);
|
|
response.end();
|
|
}));
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const session = http2.connect(`http://localhost:${server.address().port}`);
|
|
const req = session.request();
|
|
|
|
req.on('response', common.mustCall((headers, flags) => {
|
|
assert.strictEqual('Date' in headers, false);
|
|
assert.strictEqual('date' in headers, false);
|
|
}));
|
|
|
|
req.on('end', common.mustCall(() => {
|
|
session.close();
|
|
server.close();
|
|
}));
|
|
}));
|