Ruby on rails RSpec在get请求时指定标头
我正在RSpec上执行以下get请求:Ruby on rails RSpec在get请求时指定标头,ruby-on-rails,ruby,rspec,http-headers,Ruby On Rails,Ruby,Rspec,Http Headers,我正在RSpec上执行以下get请求: get "api/posts/#{@post.id}?api_key=#{Settings.api_key.android}&device_token=#{@device.token}&auth_token=#{@user.authentication_token}" 我需要指定标题 在“邮递员”上,我的标题如下所示: 如何在RSpec上将我的头添加到get请求中 我试过这个: get "api/posts/#{@post.id}?api
get "api/posts/#{@post.id}?api_key=#{Settings.api_key.android}&device_token=#{@device.token}&auth_token=#{@user.authentication_token}"
我需要指定标题
在“邮递员”上,我的标题如下所示:
如何在RSpec上将我的头添加到get请求中
我试过这个:
get "api/posts/#{@post.id}?api_key=#{Settings.api_key.android}&device_token=#{@device.token}&auth_token=#{@user.authentication_token}", nil, {'ACCEPT' => 'application/vdn.foo.v10'}
没有任何成功
任何帮助都将不胜感激 看下面的答案。您还可以使用request
变量访问请求,并直接在那里操作头