commit 27a8c796e1e5925ac773442974c42ceccd884a62
parent 19dc94e5592b5d53cdff2f2a850298618c3014b1
Author: Alberto Lerda <albertolerda97@gmail.com>
Date: Wed, 5 Oct 2022 08:50:28 +0200
Zenflows.GQL.Sign: improve error message.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/zenflows/gql/mw/sign.ex b/src/zenflows/gql/mw/sign.ex
@@ -25,6 +25,8 @@ Absinthe middleware to verify GraphQL calls.
alias Zenflows.Restroom
alias Zenflows.VF.Person
+@missing_headers_auth_call "gql_user, gql_sign and gql_body headers are required for an authenticated call"
+
@impl true
def call(res, _opts) do
if res.context.authenticate_calls? do
@@ -44,7 +46,7 @@ defp fetch_ctx(res) do
case res.context do
%{gql_user: username, gql_sign: sign, gql_body: body} ->
{:ok, username, sign, body}
- _ -> {:error, "some headers are missing"}
+ _ -> {:error, @missing_headers_auth_call}
end
end