From 19f935b9aa136406da8d63791cf567da373d8f10 Mon Sep 17 00:00:00 2001 From: Aboobacker MK Date: Wed, 31 Oct 2018 18:40:51 +0530 Subject: [PATCH] Avoid mutating @url_path to avoid unexpected side effects --- lib/ruby_http_client.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ruby_http_client.rb b/lib/ruby_http_client.rb index 4d0aafd..f2bbdd6 100644 --- a/lib/ruby_http_client.rb +++ b/lib/ruby_http_client.rb @@ -212,8 +212,7 @@ def add_ssl(http) # - Client object # def _(name = nil) - url_path = name ? @url_path.push(name) : @url_path - @url_path = [] + url_path = name ? @url_path + [name] : @url_path Client.new(host: @host, request_headers: @request_headers, version: @version, url_path: url_path, http_options: @http_options)