法拉第发布到localhost,json的身体总是空着

时间:2016-11-14 02:44:19

标签: ruby faraday

使用ruby 2.3.1我尝试向localhost上的url发出post请求:

conn = Faraday.new(:url => 'http://localhost:9393') do |faraday|
  faraday.adapter :excon # make requests with Net::HTTP
  faraday.response :json
  faraday.request :json
end

conn.post('notification',
          { email: 'test@email.com', type: :forgot_password, link: 'www.link.com' }.to_json,
          { 'Content-Type' => 'application/json' })

传递的主体在服务器端到空,它甚至在法拉第输出中显示为空:

#<Faraday::Response:0x000000026d92d0
 @env=
  #<struct Faraday::Env
   method=:post,
   body=nil,
   url=#<URI::HTTP http://localhost:9393/notification>,

我错过了什么?

0 个答案:

没有答案