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>
This commit is contained in:
kyteinsky
2022-02-22 17:33:22 +00:00
committed by GitHub
parent 16e790e87e
commit 0c96993cc0
7 changed files with 994 additions and 329 deletions

View File

@@ -0,0 +1,29 @@
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
)