Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overloaded Client to accept trustAllServers parameter #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/browsermob/proxy/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ module Proxy
class Client
attr_reader :host, :port

def self.from(server_url, port = nil)
def self.from(server_url, port = nil, trust_all_servers = false)
# ActiveSupport may define Object#load, so we can't use MultiJson.respond_to? here.
sm = MultiJson.singleton_methods.map { |e| e.to_sym }
decode_method = sm.include?(:load) ? :load : :decode

new_proxy_url = URI.join(server_url, "proxy")
new_proxy_url = URI.join(server_url, "proxy", "?trustAllServers=#{trust_all_servers}")
new_proxy_url.query = "port=#{port}" if port

port = MultiJson.send(decode_method,
Expand Down
4 changes: 2 additions & 2 deletions lib/browsermob/proxy/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def url
"http://localhost:#{port}"
end

def create_proxy(port = nil)
Client.from url, port
def create_proxy(port = nil, trust_all_servers = false)
Client.from url, port, trust_all_servers
end

def stop
Expand Down