2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2010-09-30 17:12:56 -07:00
|
|
|
// Serving up a zero-length buffer should work.
|
|
|
|
|
2016-07-15 15:43:24 -04:00
|
|
|
const common = require('../common');
|
2016-12-30 18:38:06 -05:00
|
|
|
const http = require('http');
|
2010-09-30 17:12:56 -07:00
|
|
|
|
2017-11-27 17:53:12 +09:00
|
|
|
const server = http.createServer((req, res) => {
|
2017-01-08 13:19:00 +00:00
|
|
|
const buffer = Buffer.alloc(0);
|
2017-07-10 20:55:21 -04:00
|
|
|
res.writeHead(200, { 'Content-Type': 'text/html',
|
|
|
|
'Content-Length': buffer.length });
|
2010-09-30 17:12:56 -07:00
|
|
|
res.end(buffer);
|
|
|
|
});
|
|
|
|
|
2017-11-27 17:53:12 +09:00
|
|
|
server.listen(0, common.mustCall(() => {
|
|
|
|
http.get({ port: server.address().port }, common.mustCall((res) => {
|
2010-09-30 17:12:56 -07:00
|
|
|
|
2017-02-03 14:54:19 -05:00
|
|
|
res.on('data', common.mustNotCall());
|
2010-09-30 17:12:56 -07:00
|
|
|
|
2017-11-27 17:53:12 +09:00
|
|
|
res.on('end', (d) => {
|
2010-09-30 17:12:56 -07:00
|
|
|
server.close();
|
|
|
|
});
|
2016-07-15 15:43:24 -04:00
|
|
|
}));
|
|
|
|
}));
|