title: Ruby Net::HTTP.post_form add data to headers
body: <p>I'm trying to figure out how to add data to headers when using post_form using Ruby Net::HTTP</p>
  
  <p>I saw several posts on stackoverflow <a href="https://stackoverflow.com/questions/9303147/add-headers-to-a-request-in-rails">Add headers to a request in rails</a>
  and I looked through <a href="https://github.com/augustl/net-http-cheat-sheet/blob/master/headers.rb" rel="nofollow noreferrer">https://github.com/augustl/net-http-cheat-sheet/blob/master/headers.rb</a></p>
  
  <p>But, I couldn't see how to do this.  Here's my code</p>
  
  <pre><code>headers = {
              'ApiKey' =&gt; org_user.api_key,
              'Authorization' =&gt; "Bearer #{x['access_token']}",
              'Content-Type' =&gt; 'application/x-www-form-urlencoded'
            }
        # Send data 
        params = {"ContactName": org_user.first_name,
                  "MiddleName": nil,
                  "LastName": org_user.last_name,
                  "PrefixId": nil,
                  "SuffixId": nil,
                  "ContactUniqueId": nil,
                  "ContactSourceId": nil,
                  "Email": org_user.email,
                  "Fax": nil,
                  "Phone": nil,
                  "AddressLine1": nil,
                  "AddressLine2": nil,
                  "AddressLine3": nil,
                  "AddressLine4": nil,
                  "City": nil,
                  "State": nil,
                  "Zip": nil,
                  "County": nil,
                  "Country": nil,
                  "Id": nil
                  }
  
          x = Net::HTTP.post_form(URI.parse('http://www.cloudapp.net/admin/contact/create/quick/individual'), params)
  </code></pre>