From ca4b1a56288f9ebfd5a44b9dffd23b8c1f398b07 Mon Sep 17 00:00:00 2001 From: Paul Sadauskas Date: Sat, 23 Nov 2019 12:07:01 -0700 Subject: [PATCH] Fixed Endpoint#path Calling endpoint.path had the side-effect of mutating the original @url.path to add query params, so calling it multiple times would re-add the query params every time, resulting in paths like `/example?foo=bar&bam=baz?foo=bar&bam=baz`. Fixed by duping the `@url.path` for the buffer var. --- lib/async/http/endpoint.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/async/http/endpoint.rb b/lib/async/http/endpoint.rb index fd31f132..aa148e62 100644 --- a/lib/async/http/endpoint.rb +++ b/lib/async/http/endpoint.rb @@ -125,7 +125,7 @@ def authority(ignore_default_port = true) # Return the path and query components of the given URL. def path - buffer = @url.path || "/" + buffer = @url.path.dup || "/" if query = @url.query buffer = "#{buffer}?#{query}" @@ -230,4 +230,4 @@ def tcp_endpoint end end end -end \ No newline at end of file +end