web: fix error when showing error message of request
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -10,7 +10,8 @@ export class LoggingMiddleware implements Middleware {
|
||||
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 => {
|
||||
const resClone = context.response.clone();
|
||||
resClone.text().then(t => {
|
||||
msg += ` => ${t}`;
|
||||
console.debug(msg);
|
||||
});
|
||||
|
@ -37,7 +37,9 @@ export function configureSentry(canDoPpi: boolean = false): Promise<Config> {
|
||||
if (response.status < 500) {
|
||||
return null;
|
||||
}
|
||||
const body = await response.json();
|
||||
// Need to clone the response, otherwise the .text() and .json() can't be re-used
|
||||
const resCopy = response.clone();
|
||||
const body = await resCopy.json();
|
||||
event.message = `${response.status} ${response.url}: ${JSON.stringify(body)}`
|
||||
}
|
||||
if (event.exception) {
|
||||
|
Reference in New Issue
Block a user