Skip to content

Commit

Permalink
Fix HTTP::Request#headline to allow two leading slashes in path
Browse files Browse the repository at this point in the history
  • Loading branch information
scarfacedeb committed Feb 25, 2018
1 parent 66b4fff commit 3c9c335
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/http/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c9c335

Please sign in to comment.