1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const http = require('http'); 5 6const httpServer = http.createServer(common.mustCall(function(req, res) { 7 httpServer.close(); 8 assert.throws(() => { 9 res.end(['Throws.']); 10 }, { 11 code: 'ERR_INVALID_ARG_TYPE' 12 }); 13 res.end(); 14})); 15 16httpServer.listen(0, common.mustCall(function() { 17 http.get({ port: this.address().port }); 18})); 19