FIX: Prevent 'rack.input' missing error.

This commit is contained in:
Guo Xiang Tan 2017-12-12 16:40:35 +08:00
parent 1d43d7f136
commit 6ade508f39
2 changed files with 6 additions and 1 deletions

View File

@ -39,7 +39,7 @@ class Auth::DefaultCurrentUserProvider
request = @request
user_api_key = @env[USER_API_KEY]
api_key = request[API_KEY]
api_key = @env.blank? ? nil : request[API_KEY]
auth_token = request.cookies[TOKEN_COOKIE] unless user_api_key || api_key

View File

@ -16,6 +16,11 @@ describe Auth::DefaultCurrentUserProvider do
TestProvider.new(env)
end
it "can be used to pretend that a user doesn't exist" do
provider = TestProvider.new({})
expect(provider.current_user).to eq(nil)
end
context "server api" do
it "raises errors for incorrect api_key" do