postmanlabs / curl-to-postman

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

Fixed an issue where request generation failed for certain bash operators. #57

Closed VShingala closed 1 year ago

VShingala commented 1 year ago

Overview

The current convert API failed to generate requests correctly for certain cURL containing bash operators like < and >. For example, below cURL

curl --request GET \
  --url https://hello.com/company/<companyId>/team \
  --header "Authorization: Basic aGVsbG86d29ybGQ="

RCA

When such operators were used in the URL, the cURL parser (commander) assigned < and > as separate arg. This resulted in an Error as we're throwing an error when there were more than 1 args.

Fix

We'll be now also using multiple arguments from parsed cURL and constructing URLs based on allowed operators. Instead of throwing an error, we'll now handle such cURLs gracefully and use the first constructed arg as a URL. This constructed URL will contain allowed operators along with strings that were split by them.