Set the default User-Agent sent for outgoing http requests.

* Add a `Danbooru.config.http_headers` config option.

* Refactor various places to use this option instead of setting the user
  agent manually.
This commit is contained in:
evazion
2017-07-19 19:37:14 -05:00
parent d48ed95191
commit 8125d8e796
8 changed files with 29 additions and 48 deletions

View File

@@ -20,12 +20,8 @@ module Downloads
end
protected
def http_head_request(url, headers)
HTTParty.head(url, Danbooru.config.httparty_options.merge(headers: headers))
end
def http_exists?(url, headers)
res = http_head_request(url, headers)
res = HTTParty.head(url, Danbooru.config.httparty_options.deep_merge(headers: headers))
res.success?
end
end