Skip to content

Commit 44ba99f

Browse files
authored
Merge pull request #462 from scarfacedeb/fix_two_slashes_bug
Fix HTTP::Request#headline to allow two leading slashes in path
2 parents 66b4fff + 3c9c335 commit 44ba99f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/http/request.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def headline
154154
if using_proxy? && !uri.https?
155155
uri.omit(:fragment)
156156
else
157-
uri.omit(:scheme, :authority, :fragment)
157+
uri.request_uri
158158
end
159159

160160
"#{verb.to_s.upcase} #{request_uri} HTTP/#{version}"

spec/lib/http_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
end
4242
end
4343

44+
context "with two leading slashes in path" do
45+
it "is allowed" do
46+
expect { HTTP.get "#{dummy.endpoint}//" }.not_to raise_error
47+
end
48+
end
49+
4450
context "with headers" do
4551
it "is easy" do
4652
response = HTTP.accept("application/json").get dummy.endpoint

0 commit comments

Comments
 (0)