From 3c9c3353a0cdd513f1ea0c54a620c9719bcfd905 Mon Sep 17 00:00:00 2001 From: scarfacedeb Date: Sun, 25 Feb 2018 23:12:25 +0300 Subject: [PATCH] Fix HTTP::Request#headline to allow two leading slashes in path --- lib/http/request.rb | 2 +- spec/lib/http_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/http/request.rb b/lib/http/request.rb index 66e11b8d..5a4ce713 100644 --- a/lib/http/request.rb +++ b/lib/http/request.rb @@ -154,7 +154,7 @@ def headline if using_proxy? && !uri.https? uri.omit(:fragment) else - uri.omit(:scheme, :authority, :fragment) + uri.request_uri end "#{verb.to_s.upcase} #{request_uri} HTTP/#{version}" diff --git a/spec/lib/http_spec.rb b/spec/lib/http_spec.rb index 341dfdde..403c5da5 100644 --- a/spec/lib/http_spec.rb +++ b/spec/lib/http_spec.rb @@ -41,6 +41,12 @@ end end + context "with two leading slashes in path" do + it "is allowed" do + expect { HTTP.get "#{dummy.endpoint}//" }.not_to raise_error + end + end + context "with headers" do it "is easy" do response = HTTP.accept("application/json").get dummy.endpoint