summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2021-05-21 10:11:53 +0900
committerBert Belder <bertbelder@gmail.com>2021-05-31 16:37:32 +0200
commit7b1fd3d146292df01f61e9eb0202779be8d7da33 (patch)
tree584fec211b24850101d68924c4a5029678569b07 /runtime/js
parent25b784f00d40e20714709bf61e09046d4b9c8fd8 (diff)
fix(runtime/http): fix empty blob response (#10689)
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;