Files
hoppscotch/packages/hoppscotch-app/helpers/curl/index.ts
kyteinsky 0c96993cc0 fix: parsing of protocol correctly (#2088)
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>
2022-02-22 23:03:22 +05:30

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
)