You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
593 B

'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();
});
});