Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: improvement for body tab and RawBody empty string bug (#4273)

Dmitryf1cb417a5ee2
diff --git a/packages/hoppscotch-common/src/components/http/RawBody.vue b/packages/hoppscotch-common/src/components/http/RawBody.vue
index 07c639cb6..7def623dc 100644
--- a/packages/hoppscotch-common/src/components/http/RawBody.vue
+++ b/packages/hoppscotch-common/src/components/http/RawBody.vue
@@ -143,7 +143,7 @@ watch(rawParamsBody, (newVal) => {
// propagate the edits from codemirror back to the body
watch(codemirrorValue, (updatedValue) => {
- if (updatedValue && updatedValue !== rawParamsBody.value) {
+ if (updatedValue !== undefined && updatedValue !== rawParamsBody.value) {
rawParamsBody.value = updatedValue
}
})
diff --git a/packages/hoppscotch-common/src/components/http/RequestOptions.vue b/packages/hoppscotch-common/src/components/http/RequestOptions.vue
index 6f9afe1bb..55c079e17 100644
--- a/packages/hoppscotch-common/src/components/http/RequestOptions.vue
+++ b/packages/hoppscotch-common/src/components/http/RequestOptions.vue
@@ -16,6 +16,7 @@
v-if="properties?.includes('bodyParams') ?? true"
:id="'bodyParams'"
:label="`${t('tab.body')}`"
+ :indicator="isBodyFilled"
>
<HttpBody
v-model:headers="request.headers"
@@ -154,6 +155,10 @@ const newActiveRequestVariablesCount = computed(() => {
return count ? count : null
})
+const isBodyFilled = computed(() => {
+ return Boolean(request.value.body.body && request.value.body.body.length > 0)
+})
+
defineActionHandler("request.open-tab", ({ tab }) => {
selectedOptionTab.value = tab as RESTOptionTabs
})