Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: parse body from url params
Manda Putraf428a212795f
diff --git a/packages/hoppscotch-app/pages/index.vue b/packages/hoppscotch-app/pages/index.vueindex fc161f8c7..33453d804 100644--- a/packages/hoppscotch-app/pages/index.vue+++ b/packages/hoppscotch-app/pages/index.vue@@ -136,7 +136,10 @@ import {} from "~/helpers/utils/composables"import { loadRequestFromSync, startRequestSync } from "~/helpers/fb/request"import { onLoggedIn } from "~/helpers/fb/auth"-import { HoppRESTRequest } from "~/helpers/types/HoppRESTRequest"+import {+ FormDataKeyValue,+ HoppRESTRequest,+} from "~/helpers/types/HoppRESTRequest"import { oauthRedirect } from "~/helpers/oauth"import { HoppRESTAuthOAuth2 } from "~/helpers/types/HoppRESTAuth"import useWindowSize from "~/helpers/utils/useWindowSize"@@ -161,6 +164,17 @@ function bindRequestToURLParams() {return filtered.length > 0 ? JSON.stringify(filtered) : null})+ const contentType = request.value.body.contentType++ const body = computed(() => {+ if (contentType === "multipart/form-data") {+ const body = request.value.body.body as FormDataKeyValue[]+ const filtered = body.filter((x) => x.key !== "")+ return filtered.length > 0 ? JSON.stringify(filtered) : null+ }+ return JSON.stringify(request.value.body)+ })+// Combine them together to a cleaner valueconst urlParams = computed(() => ({v: request.value.v,@@ -168,6 +182,7 @@ function bindRequestToURLParams() {endpoint: request.value.endpoint,headers: headers.value,params: params.value,+ body: JSON.stringify({ contentType, body }),}))// Watch and update accordingly