feat: add reason phrase to http status code

This commit is contained in:
liyasthomas
2021-12-21 21:42:31 +05:30
parent 3e8ff8ebc9
commit 889b59e1e4
9 changed files with 183 additions and 41 deletions

View File

@@ -101,22 +101,46 @@
</div>
</div>
<div
v-if="response.type === 'success' || 'fail'"
:class="statusCategory.className"
class="font-semibold space-x-4"
v-if="response.type === 'success' || response.type === 'fail'"
class="font-semibold flex items-center text-tiny"
>
<span v-if="response.statusCode">
<span class="text-secondary"> {{ t("response.status") }}: </span>
{{ response.statusCode || t("state.waiting_send_request") }}
</span>
<span v-if="response.meta && response.meta.responseDuration">
<span class="text-secondary"> {{ t("response.time") }}: </span>
{{ `${response.meta.responseDuration} ms` }}
</span>
<span v-if="response.meta && response.meta.responseSize">
<span class="text-secondary"> {{ t("response.size") }}: </span>
{{ `${response.meta.responseSize} B` }}
</span>
<div
:class="statusCategory.className"
class="space-x-4 inline-flex flex-1"
>
<span v-if="response.statusCode">
<span class="text-secondary"> {{ t("response.status") }}: </span>
{{ `${response.statusCode}\xA0 • \xA0`
}}{{ getStatusCodeReasonPhrase(response.statusCode) }}
</span>
<span v-if="response.meta && response.meta.responseDuration">
<span class="text-secondary"> {{ t("response.time") }}: </span>
{{ `${response.meta.responseDuration} ms` }}
</span>
<span v-if="response.meta && response.meta.responseSize">
<span class="text-secondary"> {{ t("response.size") }}: </span>
{{ `${response.meta.responseSize} B` }}
</span>
</div>
<div class="inline-flex">
<tippy
ref="options"
interactive
trigger="click"
theme="popover"
arrow
>
<template #trigger>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
:title="t('settings.interceptor')"
svg="globe"
class="!p-0"
/>
</template>
<AppInterceptor />
</tippy>
</div>
</div>
</div>
</div>
@@ -128,6 +152,7 @@ import findStatusGroup from "~/helpers/findStatusGroup"
import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse"
import { getPlatformSpecialKey as getSpecialKey } from "~/helpers/platformutils"
import { useI18n } from "~/helpers/utils/composables"
import { getStatusCodeReasonPhrase } from "~/helpers/utils/statusCodes"
const t = useI18n()
@@ -141,7 +166,10 @@ const statusCategory = computed(() => {
props.response.type === "network_fail" ||
props.response.type === "script_fail"
)
return ""
return {
name: "error",
className: "text-red-500",
}
return findStatusGroup(props.response.statusCode)
})
</script>