Skip to content

Commit

Permalink
Merge pull request #30 from nashby/fix/deprecations
Browse files Browse the repository at this point in the history
Fix deprecation warnings for String.strip and Integer.to_char_list.
  • Loading branch information
edgurgel authored Nov 15, 2017
2 parents 03c68d8 + 41367be commit f3ed8f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/httparrot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ defmodule HTTParrot do
def prettify_json(status, headers, body, req) do
if JSX.is_json? body do
body = JSX.prettify!(body)
headers = List.keystore(headers, "content-length", 0, {"content-length", Integer.to_char_list(String.length(body))})
headers = List.keystore(headers, "content-length", 0, {"content-length", Integer.to_charlist(String.length(body))})
{:ok, req} = :cowboy_req.reply(status, headers, body, req)
req
else
Expand Down
4 changes: 2 additions & 2 deletions lib/httparrot/p_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ defmodule HTTParrot.PHandler do
defp parse_content_disposition_header(header) do
parts = elem(header, 1)
|> String.split(";")
|> Enum.map(&String.strip/1)
|> Enum.map(&String.trim/1)

for part <- parts, into: %{} do
case String.split(part, "=") |> Enum.map(&String.strip/1) do
case String.split(part, "=") |> Enum.map(&String.trim/1) do
[type] -> {:type, type}
[key, value] -> {key, String.replace(value, "\"", "")}
end
Expand Down

0 comments on commit f3ed8f8

Please sign in to comment.