Ruby on rails ';授权';报头返回零

Ruby on rails ';授权';报头返回零,ruby-on-rails,Ruby On Rails,我有一个设置授权头的测试 test "index should return a list of shifts at a given date" do @request.env["Custom_authorization"] = "bar" @request.env["Authorization"] = "bar" get :index, { date: '2015/9/8' } assert_response :success end

我有一个设置授权头的测试

  test "index should return a list of shifts at a given date" do
    @request.env["Custom_authorization"] = "bar"
    @request.env["Authorization"] = "bar"
    get :index,
        { date: '2015/9/8' }

    assert_response :success
  end
出于某种原因,“授权”标题被设置为零,即使设置了客户授权标题:

(byebug) request.headers['Authorization']
nil
(byebug) request.headers['Custom_authorization']
"bar"

“Authorization”头在哪里设置为nil?

获取方法原型是

 get(path, parameters = nil, headers_or_env = nil)
参考文献:

所以,像这样使用它

get :index, { date: '2015/9/8' }, { "Authorization" => "bar" }
下面的方法应该有效 (byebug)请求.头文件[:授权]