mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
http: fix double AbortSignal registration
Fix an issue where AbortSignals are registered twice PR-URL: https://github.com/nodejs/node/pull/37730 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
9f61cbd1fd
commit
e9c161ce12
5 files changed
+143
-17
No files matched your search
@@ -7,7 +7,7 @@ if (!common.hasCrypto)
|
||||
const fixtures = require('../common/fixtures');
|
||||
const https = require('https');
|
||||
const assert = require('assert');
|
||||
const { once } = require('events');
|
||||
const { once, getEventListeners } = require('events');
|
||||
|
||||
const options = {
|
||||
key: fixtures.readKey('agent1-key.pem'),
|
||||
@@ -29,6 +29,7 @@ const options = {
|
||||
rejectUnauthorized: false,
|
||||
signal: ac.signal,
|
||||
});
|
||||
assert.strictEqual(getEventListeners(ac.signal, 'abort').length, 1);
|
||||
process.nextTick(() => ac.abort());
|
||||
const [ err ] = await once(req, 'error');
|
||||
assert.strictEqual(err.name, 'AbortError');
|
||||
|
||||
Reference in new issue
Block a user