visola/go-http-cli

Variables in form bodies don't work

Closed this issue · 0 comments

If I have a request like the following:

requests:
  auth:
    url: /oauth/token
    method: POST
    headers:
      Content-Type: application/x-www-form-urlencoded
    values:
      grant_type: client_credentials
      client_id: '{clientId}'
      client_secret: '{clientSecret}'

The values in the body get URL encoded before variable replacing happens. That means that when it gets to replace the values it doesn't work.

Possible solutions:

  • URL encode body later
  • Do not URL encode { and } so that they get found and replaced later