FIX: Prevent 'rack.input' missing error.
This commit is contained in:
parent
1d43d7f136
commit
6ade508f39
|
@ -39,7 +39,7 @@ class Auth::DefaultCurrentUserProvider
|
||||||
request = @request
|
request = @request
|
||||||
|
|
||||||
user_api_key = @env[USER_API_KEY]
|
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
|
auth_token = request.cookies[TOKEN_COOKIE] unless user_api_key || api_key
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,11 @@ describe Auth::DefaultCurrentUserProvider do
|
||||||
TestProvider.new(env)
|
TestProvider.new(env)
|
||||||
end
|
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
|
context "server api" do
|
||||||
|
|
||||||
it "raises errors for incorrect api_key" do
|
it "raises errors for incorrect api_key" do
|
||||||
|
|
Loading…
Reference in New Issue