Skip to content

Commit 7414560

Browse files
KhafraDevmetcoder95
authored andcommitted
fix: fetch don't finalize on abort
1 parent 3aa4df8 commit 7414560

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/fetch/index.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,13 +1597,10 @@ function httpNetworkFetch (
15971597

15981598
// 2. If aborted, then:
15991599
function onResponseAborted () {
1600-
// 1. Finalize response for fetchParams and response.
1601-
finalizeResponse(fetchParams, response)
1602-
1603-
// 2. Let aborted be the termination’s aborted flag.
1600+
// 1. Let aborted be the termination’s aborted flag.
16041601
const aborted = this.terminated.aborted
16051602

1606-
// 3. If aborted is set, then:
1603+
// 2. If aborted is set, then:
16071604
if (aborted) {
16081605
// 1. Set response’s aborted flag.
16091606
response.aborted = true
@@ -1613,14 +1610,14 @@ function httpNetworkFetch (
16131610
this.controller.error(new AbortError())
16141611
}
16151612
} else {
1616-
// 4. Otherwise, if stream is readable, error stream with a TypeError.
1613+
// 3. Otherwise, if stream is readable, error stream with a TypeError.
16171614
if (isReadable(stream)) {
16181615
this.controller.error(new TypeError('terminated'))
16191616
}
16201617
}
16211618

1622-
// 5. If connection uses HTTP/2, then transmit an RST_STREAM frame.
1623-
// 6. Otherwise, the user agent should close connection unless it would be bad for performance to do so.
1619+
// 4. If connection uses HTTP/2, then transmit an RST_STREAM frame.
1620+
// 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so.
16241621
this.connection.destroy()
16251622
}
16261623

0 commit comments

Comments
 (0)