title: curl command equivalent in ruby
body: <p>I have a curl command that works well, but I need to automate this in a ruby script,</p>
  
  <p>curl cmd:</p>
  
  <pre><code>curl -u usrname:pwd -X POST --data "del=false&amp;val=100" http://localhost:1111/sample/path
  </code></pre>
  
  <p>I wrote the following code:</p>
  
  <pre><code>uri = URI::HTTPS.build(:host =&gt; "localhost", :port =&gt; 1111)
  uri.path = URI.escape("/sample/path")
  client = Net::HTTP.new("localhost", "1111")
  req = Net::HTTP::Post.new(uri.request_uri, {"User-Agent" =&gt; "UA"})
  req.set_form_data({"del" =&gt; "false", "val" =&gt; "100"})
  req.basic_auth("usrname", "pwd")
  res = client.request(req)
  </code></pre>
  
  <p>The above code is working, I had a encoded url that I was passing to URI.escape, that made me post this question about bad response. Foud the issue and fixed it :)</p>