From ca44f8bd60252fa7352c1e44ec5241bb63b978b3 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 4 Jul 2021 12:38:50 +0200 Subject: [PATCH] web: log response when >= http 400 Signed-off-by: Jens Langhammer --- web/src/api/Config.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/src/api/Config.ts b/web/src/api/Config.ts index eb2dbc3f0..530d0f5fd 100644 --- a/web/src/api/Config.ts +++ b/web/src/api/Config.ts @@ -7,7 +7,16 @@ export class LoggingMiddleware implements Middleware { post(context: ResponseContext): Promise { tenant().then(tenant => { - console.debug(`authentik/api[${tenant.matchedDomain}]: ${context.response.status} ${context.init.method} ${context.url}`); + let msg = `authentik/api[${tenant.matchedDomain}]: `; + msg += `${context.response.status} ${context.init.method} ${context.url}`; + if (context.response.status >= 400) { + context.response.text().then(t => { + msg += ` => ${t}`; + console.debug(msg); + }); + } else { + console.debug(msg); + } }); return Promise.resolve(context.response); }