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.
 
 
 
 
 
 

27 lines
623 B

'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
const server = http.createServer();
server.on('request', function(req, res) {
res.writeHead(200, {'foo': 'bar'});
res.flushHeaders();
res.flushHeaders(); // Should be idempotent.
});
server.listen(0, common.localhostIPv4, function() {
const req = http.request({
method: 'GET',
host: common.localhostIPv4,
port: this.address().port,
}, onResponse);
req.end();
function onResponse(res) {
assert.equal(res.headers['foo'], 'bar');
res.destroy();
server.close();
}
});