feat: import cURL on paste (#2037)

* feat: import cURL on paste

* feat: import cURL on paste

* feat: pasting cURL command on url field does not paste it in

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Anwarul Islam
2021-12-23 01:57:06 +06:00
committed by GitHub
parent 10586e5288
commit 1eb9eb911e
4 changed files with 46 additions and 2 deletions

View File

@@ -69,6 +69,11 @@ const parseCurlCommand = (curlCommand: string) => {
curlCommand = curlCommand.replace(/\\/gi, "")
curlCommand = curlCommand.replace(/\n/g, "")
}
// replace string for insomnia
curlCommand = curlCommand.replace(/--request /, "-X ")
curlCommand = curlCommand.replace(/--header /, "-H ")
curlCommand = curlCommand.replace(/--url /, " ")
// yargs parses -XPOST as separate arguments. just prescreen for it.
curlCommand = curlCommand.replace(/ -XPOST/, " -X POST")
curlCommand = curlCommand.replace(/ -XGET/, " -X GET")