From 1e352013a40d1e2f8ae3c693c0a4b0ea6e6220e7 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sat, 22 Jun 2024 13:27:27 +0200 Subject: [PATCH] Revert "fix: post request signal (#3354)" This reverts commit a5eac88b6c9cb760b30367993f65f330782f2283. --- lib/api/api-request.js | 5 ----- test/request-signal.js | 25 ++----------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/lib/api/api-request.js b/lib/api/api-request.js index 396b430f50e..ced5590d210 100644 --- a/lib/api/api-request.js +++ b/lib/api/api-request.js @@ -154,11 +154,6 @@ class RequestHandler extends AsyncResource { } onComplete (trailers) { - if (this.removeAbortListener) { - this.removeAbortListener() - this.removeAbortListener = null - } - util.parseHeaders(trailers, this.trailers) this.res.push(null) } diff --git a/test/request-signal.js b/test/request-signal.js index 94ba8ec796b..fd4d2f885a5 100644 --- a/test/request-signal.js +++ b/test/request-signal.js @@ -36,11 +36,9 @@ test('post abort signal', async (t) => { server.listen(0, async () => { const ac = new AbortController() - const uresPromise = request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal }) + const ures = await request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal }) ac.abort() - try { - const ures = await uresPromise /* eslint-disable-next-line no-unused-vars */ for await (const chunk of ures.body) { // Do nothing... @@ -63,11 +61,9 @@ test('post abort signal w/ reason', async (t) => { server.listen(0, async () => { const ac = new AbortController() const _err = new Error() - const uresPromise = request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal }) + const ures = await request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal }) ac.abort(_err) - try { - const ures = await uresPromise /* eslint-disable-next-line no-unused-vars */ for await (const chunk of ures.body) { // Do nothing... @@ -78,20 +74,3 @@ test('post abort signal w/ reason', async (t) => { }) await t.completed }) - -test('post abort signal after request completed', async (t) => { - t = tspl(t, { plan: 1 }) - - const server = createServer((req, res) => { - res.end('asd') - }) - after(() => server.close()) - - server.listen(0, async () => { - const ac = new AbortController() - const ures = await request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal }) - ac.abort() - t.equal(await ures.body.text(), 'asd') - }) - await t.completed -})