我正在尝试使用 rest-client gem 发布一些东西,但由于某种原因,我不断收到内部服务器错误。我在 Chrome 上使用了 Simple REST Client,并且得到了同样的错误,除非我发送以下标题:
Content-Type: application/x-www-form-urlencoded
所以我试图用 post 请求发送那个标头,但由于某种原因,它仍然无法正常工作。这是我尝试过的:
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'
有人可以告诉我我做错了什么吗?已经搜索了一些指示如何设置标题的文档,但似乎没有任何效果。