mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
d5e363b77e
PR-URL: https://github.com/nodejs/node/pull/20094 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
27 lines
679 B
JavaScript
27 lines
679 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
const assert = require('assert');
|
|
|
|
const server = http.createServer(common.mustCall(function(req, res) {
|
|
req.on('aborted', common.mustCall(function() {
|
|
assert.strictEqual(this.aborted, true);
|
|
server.close();
|
|
}));
|
|
assert.strictEqual(req.aborted, false);
|
|
res.write('hello');
|
|
}));
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const req = http.get({
|
|
port: server.address().port,
|
|
headers: { connection: 'keep-alive' }
|
|
}, common.mustCall((res) => {
|
|
res.on('aborted', common.mustCall(() => {
|
|
assert.strictEqual(res.aborted, true);
|
|
}));
|
|
req.abort();
|
|
}));
|
|
}));
|