Copy as Curl, items that are Body>form-url-encoded do not receive curl's --data-urlencode
#316
Labels
bug
Something isn't working
--data-urlencode
#316
The "Copy as Curl" feature, in cases when you have data that needs URL encoding (meaning you set "Body>form-url-encoded" fields in RF), is exporting the command without the equivalent
--data-urlencode
(it uses `--data="..." for every field).Impact:
If your Restfox body fields contained URL-unsafe characters ($, @, etc.) then the exported curl will not send data correctly, and you will likely receive an API response error.
Workaround:
If you manually change
--data=
to--data-urlencode=
then the exported command works.Possible solutions:
Just use
--data-urlencode
for almost everything.With curl, it always does the right thing with
--data-urlencode=
(if no URL unsafe characters exist, then the data is 100% identical to what's sent using--data=
. The only corner issue I see is if the RF user had manually "pre-encoded" their data, using shell commands, which seems unlikely)You could trigger this off RF's Body "type" setting provided by the user, and use what you know about body types to automatically set fields for curl data.
EXAMPLE STEPS:
ASDF%z...redacted...2@#diy
" (note: has url-unsafe special chars)exported curl: ```
curl --request POST
--url https://example.com/oauth/token
--header 'content-type: application/x-www-form-urlencoded'
--data client_id=myusername
--data 'client_secret=PMY%...redacted...2@#diy'
--data grant_type=client_credentials
The text was updated successfully, but these errors were encountered: