Skip to content

Commit

Permalink
ensure explicit stub params override uri components
Browse files Browse the repository at this point in the history
closes #381
  • Loading branch information
geemus committed Apr 30, 2014
1 parent 206677d commit 03e409f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/excon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ def stub(request_params = {}, response_params = nil)
end
if url = request_params.delete(:url)
uri = URI.parse(url)
request_params.update(
request_params = {
:host => uri.host,
:path => uri.path,
:port => uri.port,
:query => uri.query,
:scheme => uri.scheme
)
}.merge!(request_params)
if uri.user || uri.password
request_params[:headers] ||= {}
user, pass = Utils.unescape_form(uri.user.to_s), Utils.unescape_form(uri.password.to_s)
Expand Down

0 comments on commit 03e409f

Please sign in to comment.