1
0
Fork 0
mirror of https://github.com/edgurgel/httparrot synced 2025-04-10 12:12:24 -04:00

Fix deprecation warnings for String.strip and Integer.to_char_list.

This commit is contained in:
Vasiliy Ermolovich 2017-11-15 11:07:19 +03:00
parent 03c68d85a6
commit 41367be61f
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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