Skip to content

Commit 8635fcc

Browse files
committed
Make URI.encode* to work only with binaries
1 parent 65809a5 commit 8635fcc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/elixir/lib/uri.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ defmodule URI do
189189
"ftp://s-ite.tld/?value=put%20it+%D0%B9"
190190
191191
"""
192-
def encode(str, predicate \\ &char_unescaped?/1) do
192+
def encode(str, predicate \\ &char_unescaped?/1) when is_binary(str) do
193193
for <<c <- str>>, into: "", do: percent(c, predicate)
194194
end
195195

@@ -202,7 +202,7 @@ defmodule URI do
202202
"put%3A+it%2B%D0%B9"
203203
204204
"""
205-
def encode_www_form(str) do
205+
def encode_www_form(str) when is_binary(str) do
206206
for <<c <- str>>, into: "" do
207207
case percent(c, &char_unreserved?/1) do
208208
"%20" -> "+"

0 commit comments

Comments
 (0)