How to define headers in a post request from RequestHelpers in Rails 4 -


i want test rails webhooks , can't manage have post() sending proper headers here :

require 'test_helper' module hooks   class hookscontrollertest < actioncontroller::testcase      test 'non-json request fails 406'       post :update, headers: {'content-type' => 'application/x-www-form-urlencoded'}       assert_response 406     end      #... 

this controller :

module hooks   class hookscontroller < applicationcontroller     skip_before_filter  :verify_authenticity_token      def update       byebug       #... 

and in request object receive :

request.headers['content-type'] # nil 

and have field in headers :

["query_string", "content-type=application%2fx-www-form-urlencoded"] 

note : when use hurl.it send post request same defined header field works fine , field this

["content_type", "application/x-www-form-urlencoded"] 

i using post method wrong? thank you.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -