如何将headers
添加到我的获取request
。
it "can find an account" do
get "/accounts/#{@acc.id}/", headers # like the token or whatever your api needs
end
以下是我传递令牌的controller
方法,现在我将如何append
传递给get request
。
Account.find(id: @acc.id, authorization: @auth_token);
答案 0 :(得分:1)
使用request.env
设置标题
it "can find an account" do
request.env['AUTH_TOKEN'] = "token"
get "/accounts/#{@acc.id}/"
end
答案 1 :(得分:1)