Rails 4.2 Rest_client(找不到404资源)错误

时间:2015-10-08 12:57:31

标签: ruby-on-rails rest ruby-on-rails-4

我正在尝试使用rest_client gem向已知客户端发送自定义REST响应。 我从gem's readme on github

中获取了此代码段
require 'rest_client'

 module broadcast_updates(url)
   def broadcast_updates(url)
    RestClient.post('http://127.0.0.1:80',{:transfer => {:param => 'helloworld'}})
   end
  end

每当broadcast_updates被点击时,我都会收到以下错误:

 RestClient::ResourceNotFound: 404 Resource Not Found: 
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
 <title>Object not found!</title> <link rev="made" href="mailto:you@example.com" />
 <style type="text/css"><!--/*--><![CDATA[/*><!--*/ 
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
 /*]]>*/--></style>
</head>

<body>
 <h1>Object not found!</h1>
<p>

The requested URL was not found on this server.

If you entered the URL manually please check your
spelling and try again.
</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:you@example.com">webmaster</a>.
</p>

 <h2>Error 404</h2>
 <address>
  <a href="/">localhost</a><br />
  <span>Apache/2.4.16 (Unix) PHP/5.6.14</span>
 </address>
 </body>
 </html>

0 个答案:

没有答案