1

Using ruby 2.3.1 I try to make a post request to a url on the localhost:

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' })

The passed body arrives empty on the server side, it even shows empty in faraday output:

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

What am I missing?

Calin
  • 6,661
  • 7
  • 49
  • 80

0 Answers0