diff --git a/components/lenses/ResponseBodyRenderer.vue b/components/lenses/ResponseBodyRenderer.vue index 7bbe398a5..a4974568c 100644 --- a/components/lenses/ResponseBodyRenderer.vue +++ b/components/lenses/ResponseBodyRenderer.vue @@ -10,9 +10,9 @@ @@ -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.vue index 14528a381..275fbe9a4 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -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"] &&