mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Merge pull request #2157 from douniwan5788/web_request_proxy
add proxy support for WebRequestConcern
This commit is contained in:
commit
23299f5fb2
1 changed files with 7 additions and 1 deletions
|
@ -62,7 +62,11 @@ module WebRequestConcern
|
|||
if options['user_agent'].present?
|
||||
errors.add(:base, "user_agent must be a string") unless options['user_agent'].is_a?(String)
|
||||
end
|
||||
|
||||
|
||||
if options['proxy'].present?
|
||||
errors.add(:base, "proxy must be a string") unless options['proxy'].is_a?(String)
|
||||
end
|
||||
|
||||
if options['disable_ssl_verification'].present? && boolify(options['disable_ssl_verification']).nil?
|
||||
errors.add(:base, "if provided, disable_ssl_verification must be true or false")
|
||||
end
|
||||
|
@ -114,6 +118,8 @@ module WebRequestConcern
|
|||
builder.headers = headers if headers.length > 0
|
||||
|
||||
builder.headers[:user_agent] = user_agent
|
||||
|
||||
builder.proxy interpolated['proxy'].presence
|
||||
|
||||
unless boolify(interpolated['disable_redirect_follow'])
|
||||
builder.use FaradayMiddleware::FollowRedirects
|
||||
|
|
Loading…
Add table
Reference in a new issue