1'use strict'; 2// Serving up a zero-length buffer should work. 3 4const common = require('../common'); 5const http = require('http'); 6 7const server = http.createServer((req, res) => { 8 const buffer = Buffer.alloc(0); 9 res.writeHead(200, { 'Content-Type': 'text/html', 10 'Content-Length': buffer.length }); 11 res.end(buffer); 12}); 13 14server.listen(0, common.mustCall(() => { 15 http.get({ port: server.address().port }, common.mustCall((res) => { 16 17 res.on('data', common.mustNotCall()); 18 19 res.on('end', (d) => { 20 server.close(); 21 }); 22 })); 23})); 24