diff --git a/lib/mihari/concerns/retriable.rb b/lib/mihari/concerns/retriable.rb index 510d1f3a..1609c102 100644 --- a/lib/mihari/concerns/retriable.rb +++ b/lib/mihari/concerns/retriable.rb @@ -21,7 +21,7 @@ module Retriable case error when StatusError - error.status_code != 404 + ![401, 404].include?(error.status_code) else false end diff --git a/spec/concerns/retriable_spec.rb b/spec/concerns/retriable_spec.rb index 2e222c8a..b23eb04a 100644 --- a/spec/concerns/retriable_spec.rb +++ b/spec/concerns/retriable_spec.rb @@ -40,6 +40,13 @@ def http end end + context "with 401" do + it do + expect { subject.retriable_get("#{server.base_url}/status/401") }.to raise_error(Mihari::StatusError) + expect(subject.count).to eq(1) + end + end + context "with non-404" do it do expect { subject.retriable_get("#{server.base_url}/status/500") }.to raise_error(Mihari::StatusError)