2015-03-14 08:24:07 +01:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
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) {
|
2015-05-13 17:52:49 +02:00
|
|
|
assert.equal(req.headers['foo'], 'bar');
|
2015-03-14 08:24:07 +01:00
|
|
|
res.end('ok');
|
|
|
|
server.close();
|
|
|
|
});
|
|
|
|
server.listen(common.PORT, '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',
|
|
|
|
port: common.PORT,
|
|
|
|
});
|
|
|
|
req.setHeader('foo', 'bar');
|
|
|
|
req.flushHeaders();
|
|
|
|
});
|