mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
parent
6049c5e798
commit
3e5edd4cdb
2 changed files with 15 additions and 1 deletions
|
@ -76,7 +76,13 @@ module HTTParty
|
|||
path.path = last_uri_host + path.path
|
||||
end
|
||||
|
||||
new_uri = path.relative? ? options[:uri_adapter].parse("#{base_uri}#{path}") : path.clone
|
||||
if path.relative? && path.host
|
||||
new_uri = options[:uri_adapter].parse("#{@last_uri.scheme}:#{path}")
|
||||
elsif path.relative?
|
||||
new_uri = options[:uri_adapter].parse("#{base_uri}#{path}")
|
||||
else
|
||||
new_uri = path.clone
|
||||
end
|
||||
|
||||
# avoid double query string on redirects [#12]
|
||||
unless redirect
|
||||
|
|
|
@ -230,6 +230,14 @@ RSpec.describe HTTParty::Request do
|
|||
|
||||
expect(@request.uri).to eq(URI.parse("http://example.com/bar?foo=bar"))
|
||||
end
|
||||
|
||||
it "returns correct path when the server sets the location header to a network-path reference" do
|
||||
@request.last_uri = URI.parse("https://example.com")
|
||||
@request.path = URI.parse("//www.example.com")
|
||||
@request.redirect = true
|
||||
|
||||
expect(@request.uri).to eq(URI.parse("https://www.example.com"))
|
||||
end
|
||||
end
|
||||
|
||||
context "query strings" do
|
||||
|
|
Loading…
Add table
Reference in a new issue