Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HTTP::Request#headline to allow two leading slashes in path #462

Merged
merged 1 commit into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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