From 59c358a80a0503e9110624b2b8f96e4075694992 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 29 Feb 2024 12:17:22 +0300 Subject: [PATCH] [#108] Add return on error in tokenizer middleware Signed-off-by: Denis Kirillov --- cmd/http-gw/app.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/http-gw/app.go b/cmd/http-gw/app.go index aabb22b..4532520 100644 --- a/cmd/http-gw/app.go +++ b/cmd/http-gw/app.go @@ -549,8 +549,9 @@ func (a *app) tokenizer(h fasthttp.RequestHandler) fasthttp.RequestHandler { return func(req *fasthttp.RequestCtx) { appCtx, err := tokens.StoreBearerTokenAppCtx(a.ctx, req) if err != nil { - a.log.Error(logs.CouldNotFetchAndStoreBearerToken, zap.Error(err)) + a.log.Error(logs.CouldNotFetchAndStoreBearerToken, zap.Uint64("id", req.ID()), zap.Error(err)) response.Error(req, "could not fetch and store bearer token: "+err.Error(), fasthttp.StatusBadRequest) + return } utils.SetContextToRequest(appCtx, req) h(req)