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-01-08 13:19:00 +00:00
|
|
|
const server = http.createServer(function(req, res) {
|
|
|
|
const buffer = Buffer.alloc(0);
|
2010-12-03 04:03:18 +03:00
|
|
|
// FIXME: WTF gjslint want this?
|
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);
|
|
|
|
});
|
|
|
|
|
2016-07-15 15:43:24 -04:00
|
|
|
server.listen(0, common.mustCall(function() {
|
|
|
|
http.get({ port: this.address().port }, common.mustCall(function(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
|
|
|
|
2010-12-03 04:03:18 +03:00
|
|
|
res.on('end', function(d) {
|
2010-09-30 17:12:56 -07:00
|
|
|
server.close();
|
|
|
|
});
|
2016-07-15 15:43:24 -04:00
|
|
|
}));
|
|
|
|
}));
|