Permalink
Browse files

Merge pull request #18666 from cheunghy/auth_check_nil

Fixed undefined method error when doing http basic authentication.
  • Loading branch information...
guilleiguaran committed Jan 28, 2015
2 parents 1fb9e6e + 98277d1 commit 36082a62048248c27cdd513c943ee94b716bd7f8
@@ -106,11 +106,11 @@ def decode_credentials(request)
end
def auth_scheme(request)
request.authorization.split(' ', 2).first
request.authorization.to_s.split(' ', 2).first
end
def auth_param(request)
request.authorization.split(' ', 2).second
request.authorization.to_s.split(' ', 2).second
end
def encode_credentials(user_name, password)
@@ -83,6 +83,13 @@ def authenticate_long_credentials
assert_response :unauthorized
assert_equal "HTTP Basic: Access denied.\n", @response.body, "Authentication didn't fail for request header #{header} and long credentials"
end
test "unsuccessful authentication with #{header.downcase} and no credentials" do
get :show
assert_response :unauthorized
assert_equal "HTTP Basic: Access denied.\n", @response.body, "Authentication didn't fail for request header #{header} and no credentials"
end
end
def test_encode_credentials_has_no_newline

0 comments on commit 36082a6

Please sign in to comment.