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
fix: stop storing form data files in local session
liyasthomas4770b86948d4
diff --git a/packages/hoppscotch-app/components/http/BodyParameters.vue b/packages/hoppscotch-app/components/http/BodyParameters.vueindex ba1187b2d..d5ed4347f 100644--- a/packages/hoppscotch-app/components/http/BodyParameters.vue+++ b/packages/hoppscotch-app/components/http/BodyParameters.vue@@ -91,7 +91,7 @@:name="`attachment${index}`"type="file"multiple- class="p-1 transition cursor-pointer file:transition file:cursor-pointer text-secondaryLight hover:text-secondaryDark file:mr-4 file:py-1 file:px-4 file:rounded file:border-0 file:text-tiny text-tiny file:text-secondary hover:file:text-secondaryDark file:bg-primaryLight hover:file:bg-primaryDark"+ class="p-1 transition cursor-pointer file:transition file:cursor-pointer text-secondaryLight hover:text-secondaryDark file:mr-2 file:py-1 file:px-4 file:rounded file:border-0 file:text-tiny text-tiny file:text-secondary hover:file:text-secondaryDark file:bg-primaryLight hover:file:bg-primaryDark"@change="setRequestAttachment(index, param, $event)"/></label>diff --git a/packages/hoppscotch-app/components/http/CodegenModal.vue b/packages/hoppscotch-app/components/http/CodegenModal.vueindex 290c615af..4a47c9764 100644--- a/packages/hoppscotch-app/components/http/CodegenModal.vue+++ b/packages/hoppscotch-app/components/http/CodegenModal.vue@@ -21,19 +21,32 @@/></span></template>- <SmartItem- v-for="codegen in CodegenDefinitions"- :key="codegen.name"- :label="codegen.caption"- :info-icon="codegen.name === codegenType ? 'done' : ''"- :active-info-icon="codegen.name === codegenType"- @click.native="- () => {- codegenType = codegen.name- options.tippy().hide()- }- "- />+ <div class="flex flex-col space-y-2">+ <div class="sticky top-0">+ <input+ v-model="searchQuery"+ type="search"+ autocomplete="off"+ class="flex w-full p-4 py-2 !bg-popover input"+ :placeholder="`${t('action.search')}`"+ />+ </div>+ <div class="flex flex-col">+ <SmartItem+ v-for="codegen in filteredCodegenDefinitions"+ :key="codegen.name"+ :label="codegen.caption"+ :info-icon="codegen.name === codegenType ? 'done' : ''"+ :active-info-icon="codegen.name === codegenType"+ @click.native="+ () => {+ codegenType = codegen.name+ options.tippy().hide()+ }+ "+ />+ </div>+ </div></tippy><div class="flex justify-between flex-1"><label for="generatedCode" class="p-4">@@ -147,4 +160,12 @@ const copyRequestCode = () => {toast.success(`${t("state.copied_to_clipboard")}`)setTimeout(() => (copyIcon.value = "copy"), 1000)}++const searchQuery = ref("")++const filteredCodegenDefinitions = computed(() => {+ return CodegenDefinitions.filter((obj) =>+ Object.values(obj).some((val) => val.includes(searchQuery.value))+ )+})</script>diff --git a/packages/hoppscotch-app/components/smart/FileChip.vue b/packages/hoppscotch-app/components/smart/FileChip.vueindex 6fe91b22c..05e0f351e 100644--- a/packages/hoppscotch-app/components/smart/FileChip.vue+++ b/packages/hoppscotch-app/components/smart/FileChip.vue@@ -13,7 +13,6 @@@apply rounded;@apply pl-2;@apply pr-0.5;- @apply bg-transparent;- @apply border border-divider;+ @apply bg-primaryDark;}</style>diff --git a/packages/hoppscotch-app/newstore/localpersistence.ts b/packages/hoppscotch-app/newstore/localpersistence.tsindex 84a8de038..74f8b7d7b 100644--- a/packages/hoppscotch-app/newstore/localpersistence.ts+++ b/packages/hoppscotch-app/newstore/localpersistence.ts@@ -6,6 +6,7 @@ import isEmpty from "lodash/isEmpty"import * as O from "fp-ts/Option"import { pipe } from "fp-ts/function"import { translateToNewRequest } from "@hoppscotch/data"+import { cloneDeep } from "lodash"import {settingsStore,bulkApplySettings,@@ -284,7 +285,19 @@ function setupRequestPersistence() {}restRequest$.subscribe((req) => {- window.localStorage.setItem("restRequest", JSON.stringify(req))+ const reqClone = cloneDeep(req)+ if (reqClone.body.contentType === "multipart/form-data") {+ reqClone.body.body = reqClone.body.body.map((x) => {+ if (x.isFile)+ return {+ ...x,+ isFile: false,+ value: "",+ }+ else return x+ })+ }+ window.localStorage.setItem("restRequest", JSON.stringify(reqClone))})}