Sending http post request in Ruby by Net::HTTP
http, http-headers, ruby
Solution
The second argument of `Net::HTTP#post` needs to be a `String` containing the data to post (often form data), the headers would be in the optional third argument.
Problem
I'm sending a request with custom headers to a web service. ``` require 'uri' require 'net/http' uri = URI("https://api.site.com/api.dll") https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true headers = { 'HEADER1' => "VALUE1", 'HEADER2' => "HEADER2" } response = https.post(uri.path, headers) puts response ``` It's not working, I'm receiving an error of: ``` /usr/lib/ruby/1.9.1/net/http.rb:1932:in `send_request_with_body': undefined method `bytesize' for #<Hash:0x00000001b93a10> (NoMethodError) ``` How do I solve this? P.S. `Ruby 1.9.3`