我使用 Grape api,我需要使用自定义标头编写测试
我的代码:
it "should accept message" do
post "/api/v1/my/route", post_data, secret: "ASDFGHJKL"
last_response.status.should == 201
end
但是路线根本没有标题,我也尝试过headers['secret'] = "ASDFGHJKL"
,也request.env['secret']
没有任何效果。
如何将 rspec 中的标头传递给葡萄路线?