mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
14 lines
384 B
Ruby
14 lines
384 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module HttpHelper
|
||
|
USER_AGENT = "#{HTTP::Request::USER_AGENT} (Mastodon/#{Mastodon::VERSION}; +http://#{Rails.configuration.x.local_domain}/)"
|
||
|
|
||
|
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
|