Skip to content

Commit 1e35201

Browse files
committed
Revert "fix: post request signal (#3354)"
This reverts commit a5eac88.
1 parent a5eac88 commit 1e35201

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

lib/api/api-request.js

-5
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ class RequestHandler extends AsyncResource {
154154
}
155155

156156
onComplete (trailers) {
157-
if (this.removeAbortListener) {
158-
this.removeAbortListener()
159-
this.removeAbortListener = null
160-
}
161-
162157
util.parseHeaders(trailers, this.trailers)
163158
this.res.push(null)
164159
}

test/request-signal.js

+2-23
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ test('post abort signal', async (t) => {
3636

3737
server.listen(0, async () => {
3838
const ac = new AbortController()
39-
const uresPromise = request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal })
39+
const ures = await request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal })
4040
ac.abort()
41-
4241
try {
43-
const ures = await uresPromise
4442
/* eslint-disable-next-line no-unused-vars */
4543
for await (const chunk of ures.body) {
4644
// Do nothing...
@@ -63,11 +61,9 @@ test('post abort signal w/ reason', async (t) => {
6361
server.listen(0, async () => {
6462
const ac = new AbortController()
6563
const _err = new Error()
66-
const uresPromise = request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal })
64+
const ures = await request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal })
6765
ac.abort(_err)
68-
6966
try {
70-
const ures = await uresPromise
7167
/* eslint-disable-next-line no-unused-vars */
7268
for await (const chunk of ures.body) {
7369
// Do nothing...
@@ -78,20 +74,3 @@ test('post abort signal w/ reason', async (t) => {
7874
})
7975
await t.completed
8076
})
81-
82-
test('post abort signal after request completed', async (t) => {
83-
t = tspl(t, { plan: 1 })
84-
85-
const server = createServer((req, res) => {
86-
res.end('asd')
87-
})
88-
after(() => server.close())
89-
90-
server.listen(0, async () => {
91-
const ac = new AbortController()
92-
const ures = await request(`http://0.0.0.0:${server.address().port}`, { signal: ac.signal })
93-
ac.abort()
94-
t.equal(await ures.body.text(), 'asd')
95-
})
96-
await t.completed
97-
})

0 commit comments

Comments
 (0)