Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix: null reference when parsing error responses (fixes #1749)
Andrew Bastind5cb9f135f9d
diff --git a/components/lenses/ResponseBodyRenderer.vue b/components/lenses/ResponseBodyRenderer.vueindex 7bbe398a5..a4974568c 100644--- a/components/lenses/ResponseBodyRenderer.vue+++ b/components/lenses/ResponseBodyRenderer.vue@@ -10,9 +10,9 @@<component :is="lens.renderer" :response="response" /></SmartTab><SmartTab- v-if="Object.keys(response.headers).length !== 0"+ v-if="headerLength"id="headers"- :label="`Headers \xA0 • \xA0 ${Object.keys(response.headers).length}`"+ :label="`Headers \xA0 • \xA0 ${headerLength}`"><LensesHeadersRenderer :headers="response.headers" /></SmartTab>@@ -31,7 +31,14 @@ export default {response: { type: Object, default: () => {} },},computed: {+ headerLength() {+ if (!this.response || !this.response.headers) return 0++ return Object.keys(this.response.headers).length+ },validLenses() {+ if (!this.response) return []+return getSuitableLenses(this.response)},},diff --git a/pages/index.vue b/pages/index.vueindex 14528a381..275fbe9a4 100644--- a/pages/index.vue+++ b/pages/index.vue@@ -1626,10 +1626,11 @@ export default {// testsconst 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 bodyif (syntheticResponse.headers["content-type"] &&