title: How to urlencode url params with a curl POST but not urlencode the body data?
body: <p>When making a curl POST call with something like <code>... | curl -XPOST --data @- https://example.com/</code> can I <em>also</em> url-encode some url params on the command line (using curl itself, not bash funcs) without having to encode them myself and put them in the url argument to curl?</p>
  
  <p><strong>So I want the POST Body <em>to not be</em> urlencoded, but the url params <em>to be</em> url encoded within the same curl command.</strong></p>
  
  <p>So for example:</p>
  
  <pre><code>echo '{"username":"a","password": [1,2]}' | curl --header "Content-Type: application/json" --request POST -d@- --data-urlencode "filter=." http://localhost:8080
  </code></pre>
  
  <p>Doesn't seem to do what I want, and I have postfix my <code>https://localhost:8080/</code> url with <code>?filter...</code> which I would rather avoid for cases when the param needs a lot of encoding.</p>