Method: Webhookdb::Http.chunked_download

Defined in:
lib/webhookdb/http.rb

.chunked_download(request_url, rewindable: false, **down_kw) ⇒ Object

Convenience wrapper around Down so we can use our preferred implementation. See commit history for more info.

Raises:

  • (URI::InvalidURIError)


103
104
105
106
107
108
109
110
# File 'lib/webhookdb/http.rb', line 103

def self.chunked_download(request_url, rewindable: false, **down_kw)
  uri = URI(request_url)
  raise URI::InvalidURIError, "#{request_url} must be an http/s url" unless ["http", "https"].include?(uri.scheme)
  down_kw[:headers] ||= {}
  down_kw[:headers]["User-Agent"] ||= self.user_agent
  io = Down::Httpx.open(uri, rewindable:, **down_kw)
  return io
end