diff --git a/lib/httpx/plugins/digest_authentication.rb b/lib/httpx/plugins/digest_authentication.rb index d4dc0877..eb684627 100644 --- a/lib/httpx/plugins/digest_authentication.rb +++ b/lib/httpx/plugins/digest_authentication.rb @@ -39,10 +39,7 @@ module HTTPX requests.flat_map do |request| digest = request.options.digest - unless digest - super(request) - next - end + next super(request) unless digest probe_response = wrap { super(request).first } diff --git a/test/support/requests/plugins/authentication.rb b/test/support/requests/plugins/authentication.rb index c99b4f03..f68d7042 100644 --- a/test/support/requests/plugins/authentication.rb +++ b/test/support/requests/plugins/authentication.rb @@ -44,6 +44,14 @@ module Requests end end + def test_plugin_digest_authentication_bypass + session = HTTPX.plugin(:digest_authentication).with_headers("cookie" => "fake=fake_value") + response = session.get(digest_auth_uri) + verify_status(response, 401) + response = session.get(build_uri("/get")) + verify_status(response, 200) + end + # NTLM def test_plugin_ntlm_authentication