summaryrefslogtreecommitdiff
path: root/ext/http/01_http.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-05-18 16:13:22 +0530
committerGitHub <noreply@github.com>2022-05-18 16:13:22 +0530
commit4d8261070095e49de68ca21ac3b564887039bd24 (patch)
tree7c3d5842b76282f79de44a169d874b53e7d2af1b /ext/http/01_http.js
parenta151092aa144054c0d088843e306e51430ad4bba (diff)
fix(ext/http): no response body reader when cancelling during shutdown (#14653)
Diffstat (limited to 'ext/http/01_http.js')
-rw-r--r--ext/http/01_http.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/http/01_http.js b/ext/http/01_http.js
index c60a4b05a..c9fe8220d 100644
--- a/ext/http/01_http.js
+++ b/ext/http/01_http.js
@@ -270,11 +270,12 @@
throw new TypeError("Unreachable");
}
const resourceRid = getReadableStreamRid(respBody);
+ let reader;
if (resourceRid) {
if (respBody.locked) {
throw new TypeError("ReadableStream is locked.");
}
- const reader = respBody.getReader(); // Aquire JS lock.
+ reader = respBody.getReader(); // Aquire JS lock.
try {
await core.opAsync(
"op_http_write_resource",
@@ -296,7 +297,7 @@
throw error;
}
} else {
- const reader = respBody.getReader();
+ reader = respBody.getReader();
while (true) {
const { value, done } = await reader.read();
if (done) break;