From a6f7d7ce23e9e510bca678aa95f2160ec83eb1d6 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Tue, 7 May 2019 11:46:04 +0200 Subject: [PATCH] Raise api hook right before performing the call --- src/rest.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rest.erl b/src/rest.erl index 05d1b9d4a..9c1b28068 100644 --- a/src/rest.erl +++ b/src/rest.erl @@ -100,6 +100,7 @@ request(Server, Method, Path, Params, Mime, Data) -> {URI, Hdrs} end, Begin = os:timestamp(), + ejabberd_hooks:run(backend_api_call, Server, [Server, Method, Path]), Result = try httpc:request(Method, Req, HttpOpts, [{body_format, binary}]) of {ok, {{_, Code, _}, RetHdrs, Body}} -> try decode_json(Body) of @@ -118,7 +119,6 @@ request(Server, Method, Path, Params, Mime, Data) -> exit:Reason -> {error, {http_error, {error, Reason}}} end, - ejabberd_hooks:run(backend_api_call, Server, [Server, Method, Path]), case Result of {error, {http_error, {error, timeout}}} -> ejabberd_hooks:run(backend_api_timeout, Server, -- 2.50.1