mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
11a2ca29ba
PR-URL: https://github.com/nodejs/node/pull/14735 Refs: https://github.com/nodejs/node/issues/11273 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
27 lines
593 B
JavaScript
27 lines
593 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const server = http.createServer((req, res) => {
|
|
assert.doesNotThrow(() => {
|
|
res.removeHeader('header1', 1);
|
|
});
|
|
res.write('abc');
|
|
common.expectsError(
|
|
() => res.removeHeader('header2', 2),
|
|
{
|
|
code: 'ERR_HTTP_HEADERS_SENT',
|
|
type: Error,
|
|
message: 'Cannot remove headers after they are sent to the client'
|
|
}
|
|
);
|
|
res.end();
|
|
});
|
|
|
|
server.listen(0, () => {
|
|
http.get({ port: server.address().port }, () => {
|
|
server.close();
|
|
});
|
|
});
|