http_signatures.ex: Use Enum.map_join instead of Enum.map+Enum.join

This commit is contained in:
Haelwenn (lanodan) Monnier 2022-03-07 14:56:04 +01:00
parent d837a43b98
commit c82e1cf5d9

View file

@ -73,8 +73,7 @@ defmodule HTTPSignatures do
def build_signing_string(headers, used_headers) do def build_signing_string(headers, used_headers) do
used_headers used_headers
|> Enum.map(fn header -> "#{header}: #{headers[header]}" end) |> Enum.map_join("\n", fn header -> "#{header}: #{headers[header]}" end)
|> Enum.join("\n")
end end
def sign(private_key, key_id, headers) do def sign(private_key, key_id, headers) do
@ -90,7 +89,6 @@ defmodule HTTPSignatures do
headers: Map.keys(headers) |> Enum.join(" "), headers: Map.keys(headers) |> Enum.join(" "),
signature: signature signature: signature
] ]
|> Enum.map(fn {k, v} -> "#{k}=\"#{v}\"" end) |> Enum.map_join(",", fn {k, v} -> "#{k}=\"#{v}\"" end)
|> Enum.join(",")
end end
end end