summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/40_http.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/js/40_http.js b/runtime/js/40_http.js
index eb4d214ca..d4b658314 100644
--- a/runtime/js/40_http.js
+++ b/runtime/js/40_http.js
@@ -132,10 +132,13 @@
} else {
const reader = innerResp.body.stream.getReader();
const r1 = await reader.read();
- if (r1.done) throw new TypeError("Unreachable");
- respBody = r1.value;
- const r2 = await reader.read();
- if (!r2.done) throw new TypeError("Unreachable");
+ if (r1.done) {
+ respBody = new Uint8Array(0);
+ } else {
+ respBody = r1.value;
+ const r2 = await reader.read();
+ if (!r2.done) throw new TypeError("Unreachable");
+ }
}
} else {
innerResp.body.streamOrStatic.consumed = true;