postmanlabs / curl-to-postman

Converts curl requests to Postman Collection v2 request objects
Apache License 2.0
65 stars 31 forks source link

Fixes issue where cURL in Windows cmd formats were not imported correctly. #53

Closed VShingala closed 1 year ago

VShingala commented 1 year ago

Problem:

Original issue: https://github.com/postmanlabs/postman-app-support/issues/5182

Some of copied cURL that were in windows cmd formats were failing to import. Browsers on windows machine provides an option to copy the cURL in windows cmd format as mention below. Such cURLs failed to import.

image

RCA:

In our code, we always expect the cURL to be in bash-compatible syntax. This made it so that cURL commands where ^ (caret) were used for escaping were failing due to incorrect parsing.

Fix:

We are introducing a retry mechanism for all failing cURLs. We'll retry the conversion again after replacing certain escae characters and making the cURL command bash compatible. We are also making sure that this retry can only happens once as there's cyclic dependency of function via introducing the shouldRetry flag to the existing convertCurlToRequest() function.