mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-16 03:41:41 +00:00
Merge branch 'default_http_user_agent'
This commit is contained in:
commit
1987805952
2 changed files with 7 additions and 2 deletions
|
@ -58,7 +58,12 @@ module WebRequestConcern
|
|||
end
|
||||
|
||||
def user_agent
|
||||
interpolated['user_agent'].presence ||
|
||||
interpolated['user_agent'].presence || self.class.default_user_agent
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def default_user_agent
|
||||
ENV.fetch('DEFAULT_HTTP_USER_AGENT', Faraday.new.headers[:user_agent])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -50,7 +50,7 @@ module Agents
|
|||
|
||||
Set `force_encoding` to an encoding name if the website does not return a Content-Type header with a proper charset.
|
||||
|
||||
Set `user_agent` to a custom User-Agent name if the website does not like the default value ("Faraday v#{Faraday::VERSION}").
|
||||
Set `user_agent` to a custom User-Agent name if the website does not like the default value (`#{default_user_agent}`).
|
||||
|
||||
The `headers` field is optional. When present, it should be a hash of headers to send with the request.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue