Sending custom headers through RSpec

前端 未结 3 1008
一整个雨季
一整个雨季 2021-02-04 02:28

Given my API consumers are required to send a customer HTTP header like this:

# curl -H \'X-SomeHeader: 123\' http://127.0.0.1:3000/api/api_call.json
         


        
3条回答
  •  广开言路
    2021-02-04 02:53

    You can define it in get directly.

    get :api_call, nil, {'HTTP_FOO'=>'BAR'}
    

    I just verified it works in console.

提交回复
热议问题