Co-authored-by: Liyas Thomas <hi@liyasthomas.com> Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com> Co-authored-by: liyasthomas <liyascthomas@gmail.com> Co-authored-by: Rishabh Agarwal <45998880+RishabhAgarwal-2001@users.noreply.github.com>
30 lines
722 B
TypeScript
30 lines
722 B
TypeScript
import {
|
|
HoppRESTReqBody,
|
|
HoppRESTHeader,
|
|
HoppRESTParam,
|
|
HoppRESTAuth,
|
|
} from "@hoppscotch/data"
|
|
import { flow } from "fp-ts/function"
|
|
import { parseCurlCommand, requestToHoppRequest } from "./curlparser"
|
|
|
|
export type CurlParserRequest = {
|
|
urlString: string
|
|
urlObject: URL | undefined
|
|
compressed: boolean
|
|
queries: HoppRESTParam[]
|
|
hoppHeaders: HoppRESTHeader[]
|
|
method: string
|
|
contentType: HoppRESTReqBody["contentType"]
|
|
body: HoppRESTReqBody["body"]
|
|
cookies: Record<string, string> | undefined
|
|
cookieString: string
|
|
multipartUploads: Record<string, string>
|
|
isDataBinary: boolean
|
|
auth: HoppRESTAuth
|
|
}
|
|
|
|
export const parseCurlToHoppRESTReq = flow(
|
|
parseCurlCommand,
|
|
requestToHoppRequest
|
|
)
|