Skip to content

Commit

Permalink
Allow to pass GET parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
armandfardeau committed Jul 1, 2023
1 parent 5cba421 commit 7a1111f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

2 changes: 1 addition & 1 deletion lib/tor/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.start_socks_proxy(start_params, &block)
def self.get_with_socks_proxy(uri_or_host, host, port, path, max_redirects)
start_params = start_parameters(uri_or_host, host, port)
start_socks_proxy(start_params) do |http|
request = Net::HTTP::Get.new(path || uri_or_host.path)
request = Net::HTTP::Get.new(path || uri_or_host)
Tor.configuration.headers.each do |header, value|
request.delete(header)
request.add_field(header, value)
Expand Down
4 changes: 2 additions & 2 deletions spec/tor/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
context "with URI parameter" do
%w[http https].each do |protocol|
it "follows the #{protocol} redirects" do
stub_request(:get, "#{protocol}://google.com/").with(
stub_request(:get, "#{protocol}://google.com/?q=1234").with(
headers: {
"Accept" => "*/*",
"Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
"User-Agent" => "Ruby"
}
).to_return(status: 200, body: "", headers: {})

res = tor_http.get(URI("#{protocol}://google.com/"))
res = tor_http.get(URI("#{protocol}://google.com/?q=1234"))

expect(res.code).to eq("200")
end
Expand Down

0 comments on commit 7a1111f

Please sign in to comment.