mirror of
https://github.com/edgurgel/httparrot
synced 2025-04-18 04:24:11 -04:00
Fix deprecation warnings for String.strip and Integer.to_char_list.
This commit is contained in:
parent
03c68d85a6
commit
41367be61f
2 changed files with 3 additions and 3 deletions
|
@ -86,7 +86,7 @@ defmodule HTTParrot do
|
||||||
def prettify_json(status, headers, body, req) do
|
def prettify_json(status, headers, body, req) do
|
||||||
if JSX.is_json? body do
|
if JSX.is_json? body do
|
||||||
body = JSX.prettify!(body)
|
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)
|
{:ok, req} = :cowboy_req.reply(status, headers, body, req)
|
||||||
req
|
req
|
||||||
else
|
else
|
||||||
|
|
|
@ -111,10 +111,10 @@ defmodule HTTParrot.PHandler do
|
||||||
defp parse_content_disposition_header(header) do
|
defp parse_content_disposition_header(header) do
|
||||||
parts = elem(header, 1)
|
parts = elem(header, 1)
|
||||||
|> String.split(";")
|
|> String.split(";")
|
||||||
|> Enum.map(&String.strip/1)
|
|> Enum.map(&String.trim/1)
|
||||||
|
|
||||||
for part <- parts, into: %{} do
|
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}
|
[type] -> {:type, type}
|
||||||
[key, value] -> {key, String.replace(value, "\"", "")}
|
[key, value] -> {key, String.replace(value, "\"", "")}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue