使用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>,
我错过了什么?