fix: issues with codegen (#3293)

* fix: fix issues with httpsnippet upgrade

* chore: fix HttpSnippet import
This commit is contained in:
Akash K
2023-08-28 15:57:44 +05:30
committed by GitHub
parent 3e83828722
commit fd162e242c
5 changed files with 274 additions and 184 deletions

View File

@@ -98,7 +98,11 @@ const buildHarPostData = (req: HoppRESTRequest): Har.PostData | undefined => {
}
}
export const buildHarRequest = (req: HoppRESTRequest): Har.Request => {
export const buildHarRequest = (
req: HoppRESTRequest
): Har.Request & {
postData: Har.PostData & Exclude<Har.PostData, undefined>
} => {
return {
bodySize: -1, // TODO: It would be cool if we can calculate the body size
headersSize: -1, // TODO: It would be cool if we can calculate the header size
@@ -108,6 +112,9 @@ export const buildHarRequest = (req: HoppRESTRequest): Har.Request => {
method: req.method,
queryString: buildHarQueryStrings(req),
url: req.endpoint,
postData: buildHarPostData(req),
postData: buildHarPostData(req) ?? {
mimeType: "x-unknown",
params: [],
},
}
}

View File

@@ -1,4 +1,4 @@
import * as HTTPSnippet from "httpsnippet"
import { HTTPSnippet } from "httpsnippet"
import { HoppRESTRequest } from "@hoppscotch/data"
import * as O from "fp-ts/Option"
import * as E from "fp-ts/Either"