diff --git a/packages/hoppscotch-app/components/http/ResponseMeta.vue b/packages/hoppscotch-app/components/http/ResponseMeta.vue
index 48f8c8f5..e0ce8773 100644
--- a/packages/hoppscotch-app/components/http/ResponseMeta.vue
+++ b/packages/hoppscotch-app/components/http/ResponseMeta.vue
@@ -117,9 +117,21 @@
{{ t("response.time") }}:
{{ `${response.meta.responseDuration} ms` }}
-
+
{{ t("response.size") }}:
- {{ `${response.meta.responseSize} B` }}
+ {{
+ readableResponseSize
+ ? readableResponseSize
+ : `${response.meta.responseSize} B`
+ }}
@@ -141,6 +153,29 @@ const props = defineProps<{
response: HoppRESTResponse
}>()
+/**
+ * Gives the response size in a human readable format
+ * (changes unit from B to MB/KB depending on the size)
+ * If no changes (error res state) or value can be made (size < 1KB ?),
+ * it returns undefined
+ */
+const readableResponseSize = computed(() => {
+ if (
+ props.response.type === "loading" ||
+ props.response.type === "network_fail" ||
+ props.response.type === "script_fail" ||
+ props.response.type === "fail"
+ )
+ return undefined
+
+ const size = props.response.meta.responseSize
+
+ if (size >= 100000) return (size / 1000000).toFixed(2) + " MB"
+ if (size >= 1000) return (size / 1000).toFixed(2) + " KB"
+
+ return undefined
+})
+
const statusCategory = computed(() => {
if (
props.response.type === "loading" ||