Rest-Client Ruby Gem Headers -
i'm attempting use rest-client gem post something, reason, keep getting internal server error. used simple rest client on chrome, , got same error unless sent following header:
content-type: application/x-www-form-urlencoded
so i'm trying send header post request, reason, it's still not working. here 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 tell me i'm doing wrong? have searched on docs indicate how set header, nothing seems work.
i tried , worked fine:
options[:multipart] = true # more options resource = restclient::resource.new uri, options[:username], options[:password] resource.post options |response, request, result| .............. end
looks multipart must passed normal parameters. second arguments added headers.
hope helps
resource.post {params , request}, {custom headers here} do.... ...
Comments
Post a Comment