Question

I'm attempting to use the rest-client gem to post something, but for some reason, I keep getting Internal Server Error. I used Simple REST Client on Chrome, and got the same error unless I sent the following header:

Content-Type: application/x-www-form-urlencoded

So I'm trying to send that header with the post request, but for some reason, it's still not working. Here is what I tried:

RestClient.post "server", :content_type=>"Content-Type: application/x-www-form-urlencoded",:name=> 'Test', :message_type=> 'Request', :version=> '2.0'
RestClient.post "server", {:content_type=> "Content-Type: application/x-www-form-urlencoded"},:name=> 'Test', :message_type=> 'Request', :version=> '2.0'
RestClient.post "server", {"Content-Type" =>"Content-Type: application/x-www-form-urlencoded"},:name=> 'Test', :message_type=> 'Request', :version=> '2.0'
RestClient.post "server", :header => {:content_type=>: "Content-Type: application/x-www-form-urlencoded"},:name=> 'Test', :message_type=> 'Request', :version=> '2.0'

Can someone tell me what I'm doing wrong? Have searched all over for some docs which indicate how to set header, but nothing seems to work.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top