mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Be a little smarter with the paths that are passed in.
This is especially important for the redirect-handling in which we may be pointed to a whole 'nother scheme/host that does not match our base URI.
This commit is contained in:
parent
ae7ce30977
commit
a279df8f70
1 changed files with 2 additions and 1 deletions
|
@ -115,7 +115,8 @@ module HTTParty
|
|||
raise ArgumentError, 'only get, post, put and delete methods are supported' unless %w[get post put delete].include?(method.to_s)
|
||||
raise ArgumentError, ':headers must be a hash' if options[:headers] && !options[:headers].is_a?(Hash)
|
||||
raise ArgumentError, ':basic_auth must be a hash' if options[:basic_auth] && !options[:basic_auth].is_a?(Hash)
|
||||
uri = URI.parse("#{base_uri}#{path}")
|
||||
path = URI.parse(path)
|
||||
uri = path.relative? ? URI.parse("#{base_uri}#{path}") : path
|
||||
existing_query = uri.query ? "#{uri.query}&" : ''
|
||||
uri.query = if options[:query].blank?
|
||||
existing_query + default_params.to_query
|
||||
|
|
Loading…
Reference in a new issue