Skip to content

Commit

Permalink
Normalize HTTP status ranges for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaSinek committed Nov 15, 2024
1 parent e3a7c61 commit 3262d1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/userlist/push/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Client
HTTP_STATUS = {
ok: (200..299),
server_error: (500..599),
timeout: 408,
rate_limit: 429
timeout: 408..408,
rate_limit: 429..429
}.freeze

def initialize(config = {})
Expand Down Expand Up @@ -102,7 +102,7 @@ def error_message_for_status(status)
end

def status_type(status)
HTTP_STATUS.find { |type, range| range === status }&.first
HTTP_STATUS.find { |_, range| range.include?(status) }&.first
end

def error_mapping
Expand Down

0 comments on commit 3262d1c

Please sign in to comment.