[lib/http] cURL error with non-escaped ampersand on Command Prompt
gnh1201 opened this issue · comments
Summary
In cURL-based HTTP requests, if a query string with the "&"(non-escaped ampersand) character is included within JSON data, errors may occur in the command prompt.
For example:
var response = HTTP.create("CURL")
.setBearerAuth("<token>")
.setHeader("Accept", "application/json")
.setContentType("application/json")
.requestBody({
"url": "https://exmaple.org?foo=1&bar=2" // error
})
.put("https://exmaple.org") // equals with: open("https://exmaple.org").send()
.responseBody
;
console.log(JSON.stringify(response));
As a result:
> curl -X PUT <...> -d "{\"url\": \"https://exmaple.org?foo=1&bar=2\"}" https://exmaple.org
^ (error)
bar is not valid command
Done