Currently, I step my head against the wall several times until I get this problem. I am using ruby-1.9.3-p194 and Rails. I am trying to make a mail request that I can do with Net :: HTTP.post_form, but I can not use it here because I need to set a cookie in the header. http.post mistakenly says
"undefined method `bytesize' for #<Hash:0xb1b6c04>"
because I assume that he is trying to perform some operation on the data being sent.
Does anyone have some kind of fix or work?
thanks
headers = {'Cookie' => 'mycookieinformationinhere'} uri = URI.parse("http://asite.com/where/I/want/to/go") http = Net::HTTP.new(uri.host, uri.port) response = http.post(uri.path, {'test' => 'test'}, headers)
post ruby ruby-on-rails cookies
James
source share