postman-code-generators icon indicating copy to clipboard operation
postman-code-generators copied to clipboard

replaced encodeURI with sdk.Url, issue #435

Open ShauryaAg opened this issue 4 years ago • 4 comments

Replaced encodeURI function with sdk.Url(urlString) from postman-collection to parse the URL

ShauryaAg avatar Jan 02 '21 14:01 ShauryaAg

One of test in golang is failing because the generated code snippet includes url := "https://google.com/" instead of url := "https://google.com"

Can someone help me with this? @webholik

ShauryaAg avatar Jan 02 '21 15:01 ShauryaAg

Made a few changes in test files as mentioned in #438

ShauryaAg avatar Jan 02 '21 19:01 ShauryaAg

@webholik I have made the necessary changes, however url.toString() method doesn't URL encode ' (single-quote) and " (double-quote) character.

ShauryaAg avatar Jan 08 '21 10:01 ShauryaAg

@webholik the test fails as it doesn't URL encode ' and " character.

I think a better approach would be to parse URLs using postman-collection only but then put checks if protocol is empty (and any other conditions that I might have missed)

Something like finalUrl = `${url.protocol ? `${url.protocol}://` : '' }${url.getRemote()}${finalUrl.getPathWithQuery(true)}`

ShauryaAg avatar Jan 11 '21 13:01 ShauryaAg