This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2017-04-27 14:42:22 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module HttpHelper
|
2017-04-27 15:22:19 +02:00
|
|
|
USER_AGENT = "#{HTTP::Request::USER_AGENT} (Mastodon/#{Mastodon::Version}; +http://#{Rails.configuration.x.local_domain}/)"
|
2017-04-27 14:42:22 +02:00
|
|
|
|
|
|
|
def http_client(options = {})
|
|
|
|
timeout = { write: 10, connect: 10, read: 10 }.merge(options)
|
|
|
|
|
|
|
|
HTTP.headers(user_agent: USER_AGENT)
|
|
|
|
.timeout(:per_operation, timeout)
|
|
|
|
.follow
|
|
|
|
end
|
|
|
|
end
|