From 03e409fe8d720e7284a467b3be62a724ce8cc07c Mon Sep 17 00:00:00 2001 From: geemus Date: Wed, 30 Apr 2014 15:57:26 -0500 Subject: [PATCH] ensure explicit stub params override uri components closes #381 --- lib/excon.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/excon.rb b/lib/excon.rb index 0f564853..6524daab 100644 --- a/lib/excon.rb +++ b/lib/excon.rb @@ -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)