From c82e1cf5d90a40641a814c266f5e5d9c7e1d7011 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 7 Mar 2022 14:56:04 +0100 Subject: [PATCH] http_signatures.ex: Use Enum.map_join instead of Enum.map+Enum.join --- lib/http_signatures/http_signatures.ex | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/http_signatures/http_signatures.ex b/lib/http_signatures/http_signatures.ex index c486727..2006378 100644 --- a/lib/http_signatures/http_signatures.ex +++ b/lib/http_signatures/http_signatures.ex @@ -73,8 +73,7 @@ defmodule HTTPSignatures do def build_signing_string(headers, used_headers) do used_headers - |> Enum.map(fn header -> "#{header}: #{headers[header]}" end) - |> Enum.join("\n") + |> Enum.map_join("\n", fn header -> "#{header}: #{headers[header]}" end) end def sign(private_key, key_id, headers) do @@ -90,7 +89,6 @@ defmodule HTTPSignatures do headers: Map.keys(headers) |> Enum.join(" "), signature: signature ] - |> Enum.map(fn {k, v} -> "#{k}=\"#{v}\"" end) - |> Enum.join(",") + |> Enum.map_join(",", fn {k, v} -> "#{k}=\"#{v}\"" end) end end