diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2021-05-21 10:11:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 10:11:53 +0900 |
commit | 4a9b40b717dc7e5be59bbd4e56670d27995faf58 (patch) | |
tree | 7ad5eedef4e752733ce96d99fc380c495727d155 /runtime/js | |
parent | 8708d3c0451129792d58b7fa856101ceaa7bf487 (diff) |
fix(runtime/http): fix empty blob response (#10689)
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/40_http.js | 11 |
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; |