fix: improved codegen compat
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<SmartModal
|
||||
v-if="show"
|
||||
:title="$t('request.generate_code')"
|
||||
:title="t('request.generate_code')"
|
||||
@close="hideModal"
|
||||
>
|
||||
<template #body>
|
||||
@@ -35,7 +35,7 @@
|
||||
</tippy>
|
||||
<div class="flex flex-1 justify-between">
|
||||
<label for="generatedCode" class="px-4 pt-4 pb-4">
|
||||
{{ $t("request.generated_code") }}
|
||||
{{ t("request.generated_code") }}
|
||||
</label>
|
||||
</div>
|
||||
<SmartAceEditor
|
||||
@@ -58,14 +58,11 @@
|
||||
<template #footer>
|
||||
<ButtonPrimary
|
||||
ref="copyRequestCode"
|
||||
:label="$t('action.copy')"
|
||||
:label="t('action.copy')"
|
||||
:icon="copyIcon"
|
||||
@click.native="copyRequestCode"
|
||||
/>
|
||||
<ButtonSecondary
|
||||
:label="$t('action.dismiss')"
|
||||
@click.native="hideModal"
|
||||
/>
|
||||
<ButtonSecondary :label="t('action.dismiss')" @click.native="hideModal" />
|
||||
</template>
|
||||
</SmartModal>
|
||||
</template>
|
||||
@@ -90,7 +87,7 @@ const {
|
||||
$toast,
|
||||
app: { i18n },
|
||||
} = useContext()
|
||||
const $t = i18n.t.bind(i18n)
|
||||
const t = i18n.t.bind(i18n)
|
||||
|
||||
const options = ref<any | null>(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)
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user