title: Setting Request Headers in Ruby
body: <p>I have the rest client gem and I am defining a request like this:</p>
  
  <pre><code>url = 'http://someurl'
  request =  {"data" =&gt; data}.to_json
  response = RestClient.post(url,request,:content_type =&gt; :json, :accept =&gt; :json)
  </code></pre>
  
  <p>However I need to set the HTTP header to something. For example an API key. Which could be done in curl as:</p>
  
  <pre><code>curl -XHEAD -H x-auth-user: myusername -H x-auth-key: mykey "url"
  </code></pre>
  
  <p>Whats the best way to do this in ruby? Using this gem? Or can I do it manually to have more control.</p>