fix: improved codegen compat

This commit is contained in:
Andrew Bastin
2021-08-26 13:02:53 +05:30
parent 0b12901344
commit f5c84b57b2
2 changed files with 14 additions and 11 deletions

View File

@@ -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,
}
}