1'use strict'; 2 3const common = require('../common'); 4const http = require('http'); 5const assert = require('assert'); 6 7const server = http.createServer(common.mustCall(function(req, res) { 8 req.on('aborted', common.mustCall(function() { 9 assert.strictEqual(this.aborted, true); 10 server.close(); 11 })); 12 assert.strictEqual(req.aborted, false); 13 res.write('hello'); 14})); 15 16server.listen(0, common.mustCall(() => { 17 const req = http.get({ 18 port: server.address().port, 19 headers: { connection: 'keep-alive' } 20 }, common.mustCall((res) => { 21 res.on('aborted', common.mustCall(() => { 22 assert.strictEqual(res.aborted, true); 23 })); 24 req.abort(); 25 })); 26})); 27