闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
384 B

  1. # frozen_string_literal: true
  2. module HttpHelper
  3. USER_AGENT = "#{HTTP::Request::USER_AGENT} (Mastodon/#{Mastodon::VERSION}; +http://#{Rails.configuration.x.local_domain}/)"
  4. def http_client(options = {})
  5. timeout = { write: 10, connect: 10, read: 10 }.merge(options)
  6. HTTP.headers(user_agent: USER_AGENT)
  7. .timeout(:per_operation, timeout)
  8. .follow
  9. end
  10. end