Skip to content

Commit 2768232

Browse files
author
José Valim
committed
Merge pull request #1211 from mururu/to-binary-uri-path
to_binary for URI.Info do not ignore the path
2 parents 263c76f + bd984a5 commit 2768232

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lib/elixir/lib/uri.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ defimpl Binary.Chars, for: URI.Info do
220220
if uri.userinfo, do: result = result <> uri.userinfo <> "@"
221221
if uri.host, do: result = result <> uri.host
222222
if uri.port, do: result = result <> ":" <> integer_to_binary(uri.port)
223+
if uri.path, do: result = result <> uri.path
223224
if uri.query, do: result = result <> "?" <> uri.query
224225
if uri.fragment, do: result = result <> "#" <> uri.fragment
225226

lib/elixir/test/elixir/uri_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ defmodule URITest do
135135
assert to_binary(URI.parse("http://google.com:443")) == "http://google.com:443"
136136
assert to_binary(URI.parse("https://google.com:443")) == "https://google.com"
137137
assert to_binary(URI.parse("http://lol:[email protected]")) == "http://lol:[email protected]"
138+
assert to_binary(URI.parse("http://google.com/elixir")) == "http://google.com/elixir"
138139
assert to_binary(URI.parse("http://google.com?q=lol")) == "http://google.com?q=lol"
139140
assert to_binary(URI.parse("http://google.com?q=lol#omg")) == "http://google.com?q=lol#omg"
140141
end

0 commit comments

Comments
 (0)