diff --git a/components/http/CodegenModal.vue b/components/http/CodegenModal.vue index dc8e02cbc..71f1ef641 100644 --- a/components/http/CodegenModal.vue +++ b/components/http/CodegenModal.vue @@ -1,7 +1,7 @@ @@ -90,7 +87,7 @@ const { $toast, app: { i18n }, } = useContext() -const $t = i18n.t.bind(i18n) +const t = i18n.t.bind(i18n) const options = ref(null) @@ -123,7 +120,7 @@ const hideModal = () => emit("hide-modal") const copyRequestCode = () => { copyToClipboard(requestCode.value) copyIcon.value = "done" - $toast.success($t("state.copied_to_clipboard").toString(), { + $toast.success(t("state.copied_to_clipboard").toString(), { icon: "content_paste", }) setTimeout(() => (copyIcon.value = "content_copy"), 1000) diff --git a/helpers/codegen/codegen.ts b/helpers/codegen/codegen.ts index 81c257c73..ab6d21d8f 100644 --- a/helpers/codegen/codegen.ts +++ b/helpers/codegen/codegen.ts @@ -75,7 +75,7 @@ export type HoppCodegenContext = { bodyParams: FormDataKeyValue[] rawParams: string | null rawInput: boolean - rawRequestBody: any + rawRequestBody: string | null contentType: string | null queryString: string } @@ -138,6 +138,9 @@ function getCodegenGeneralRESTInfo( | "headers" > { const urlObj = new URL(request.effectiveFinalURL) + request.effectiveFinalParams.forEach(({ key, value }) => { + urlObj.searchParams.append(key, value) + }) return { name: request.name, @@ -168,7 +171,10 @@ function getCodegenReqBodyData( request.body.contentType === "multipart/form-data" ? request.body.body : [], - rawParams: null, + rawParams: + request.body.contentType !== "multipart/form-data" + ? request.body.body + : null, } }