Merge branch 'main' into refactor/ui

This commit is contained in:
liyasthomas
2021-07-29 09:46:06 +05:30
2 changed files with 12 additions and 4 deletions

View File

@@ -10,10 +10,10 @@
<component :is="lens.renderer" :response="response" />
</SmartTab>
<SmartTab
v-if="Object.keys(response.headers).length !== 0"
v-if="headerLength"
id="headers"
:label="$t('Headers')"
:info="Object.keys(response.headers).length.toString()"
:info="headerLength.toString()"
>
<LensesHeadersRenderer :headers="response.headers" />
</SmartTab>
@@ -32,7 +32,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)
},
},

View File

@@ -1160,10 +1160,11 @@ export default defineComponent({
// 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"] &&