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:
@@ -16,11 +16,7 @@ class ImageProxy
|
||||
raise "Proxy not allowed for this site"
|
||||
end
|
||||
|
||||
headers = {
|
||||
"Referer" => fake_referer_for(url),
|
||||
"User-Agent" => "#{Danbooru.config.safe_app_name}/#{Danbooru.config.version}"
|
||||
}
|
||||
response = HTTParty.get(url, Danbooru.config.httparty_options.merge(headers: headers))
|
||||
response = HTTParty.get(url, Danbooru.config.httparty_options.deep_merge(headers: {"Referer" => fake_referer_for(url)}))
|
||||
if response.success?
|
||||
return response
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user