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.write(['Throws.']); 10 }, { 11 code: 'ERR_INVALID_ARG_TYPE' 12 }); 13 // should not throw 14 res.write('1a2b3c'); 15 // should not throw 16 res.write(new Uint8Array(1024)); 17 // should not throw 18 res.write(Buffer.from('1'.repeat(1024))); 19 res.end(); 20})); 21 22httpServer.listen(0, common.mustCall(function() { 23 http.get({ port: this.address().port }); 24})); 25