Skip to content

Commit

Permalink
Merge pull request #997 from ninoseki/stop-retyring-on-401
Browse files Browse the repository at this point in the history
refactor: stop retrying on 401
  • Loading branch information
ninoseki authored Jan 8, 2024
2 parents 8af00a9 + 5d092f1 commit 19068fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mihari/concerns/retriable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module Retriable

case error
when StatusError
error.status_code != 404
![401, 404].include?(error.status_code)
else
false
end
Expand Down
7 changes: 7 additions & 0 deletions spec/concerns/retriable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 19068fa

Please sign in to comment.