Turk
Turk

Reputation: 232

The content type 'application/x-www-form-urlencoded' is not supported in Ruby on Rails

So I'm just trying to make a simple post request using httpclient in RoR.

I'm going through a proxy, doing ntlm authentication with the server ( I can make GET requests without a problem).

Now when I try and do a post request, I get the error mentioned in the title...

proxy = ENV['HTTP_PROXY'] client=HTTPClient.new(proxy) client.set_auth(nil,user,pass) body= [{'Content-Type' => 'application/atom+xml, :content => ...}] res = client.post('url',body) puts res.body

How am i getting this error when I clearly specify the header as atom+xml..?

Upvotes: 0

Views: 1686

Answers (1)

Wand Maker
Wand Maker

Reputation: 18762

You should use

res = client.post('url', 
          :body => "...body content...", 
          :header => {'Content-Type' => 'application/atom+xml'})

Upvotes: 1

Related Questions