Method: Webhookdb::Http.check!

Defined in:
lib/webhookdb/http.rb

.check!(response, **options) ⇒ Object

Raises:



54
55
56
57
58
59
60
61
# File 'lib/webhookdb/http.rb', line 54

def self.check!(response, **options)
  # All oks are ok
  return if response.code < 300
  # We expect 300s if we aren't following redirects
  return if response.code < 400 && !options[:follow_redirects]
  # Raise for 400s, or 300s if we were meant to follow redirects
  raise Error, response
end