fix: null reference when parsing error responses (fixes #1749)

This commit is contained in:
Andrew Bastin
2021-07-28 00:47:52 -04:00
parent 8bf9a1e821
commit d5cb9f135f
2 changed files with 12 additions and 4 deletions

View File

@@ -1626,10 +1626,11 @@ export default {
// tests
const syntheticResponse = {
status: this.response.status,
body: this.response.body,
headers: this.response.headers,
body: this.response.body || new Uint8Array([]),
headers: this.response.headers || [],
}
this.response.body = this.response.body || new Uint8Array([])
// Parse JSON body
if (
syntheticResponse.headers["content-type"] &&