2015-03-14 08:24:07 +01:00
|
|
|
'use strict';
|
2016-05-29 09:06:56 +02:00
|
|
|
require('../common');
|
2015-03-14 08:24:07 +01:00
|
|
|
const assert = require('assert');
|
|
|
|
const http = require('http');
|
|
|
|
|
|
|
|
const server = http.createServer();
|
2015-05-19 13:00:06 +02:00
|
|
|
server.on('request', function(req, res) {
|
2017-01-08 16:36:25 +01:00
|
|
|
assert.strictEqual(req.headers['foo'], 'bar');
|
2015-03-14 08:24:07 +01:00
|
|
|
res.end('ok');
|
|
|
|
server.close();
|
|
|
|
});
|
2016-05-29 09:06:56 +02:00
|
|
|
server.listen(0, '127.0.0.1', function() {
|
2015-10-08 19:41:29 +02:00
|
|
|
const req = http.request({
|
2015-03-14 08:24:07 +01:00
|
|
|
method: 'GET',
|
|
|
|
host: '127.0.0.1',
|
2016-05-29 09:06:56 +02:00
|
|
|
port: this.address().port,
|
2015-03-14 08:24:07 +01:00
|
|
|
});
|
|
|
|
req.setHeader('foo', 'bar');
|
|
|
|
req.flushHeaders();
|
|
|
|
});
|