Merged in feat/redirect-add-logging (pull request #2105)
feat: add scandic-redirect logging * feat: add scandic-redirect logging Approved-by: Michael Zetterberg
This commit is contained in:
@@ -52,11 +52,18 @@ export default async (req: Request) => {
|
||||
? redirectUrl.slice(0, -1)
|
||||
: redirectUrl;
|
||||
if (redirectUrlWithoutTrailingSlash === body.pathname) {
|
||||
console.log(
|
||||
`[scandic-redirect] recieved ${body.pathname}, found ${redirectUrlWithoutTrailingSlash}, no-op`
|
||||
);
|
||||
return new Response("Not Found", { status: 404 });
|
||||
}
|
||||
console.log(
|
||||
`[scandic-redirect] recieved ${body.pathname}, return ${redirectUrlWithoutTrailingSlash}, success`
|
||||
);
|
||||
return new Response(redirectUrlWithoutTrailingSlash);
|
||||
}
|
||||
}
|
||||
console.log(`[scandic-redirect] recieved ${body.pathname}, not found`);
|
||||
return new Response("Not Found", { status: 404 });
|
||||
} catch (error) {
|
||||
return new Response("Bad request", { status: 400 });
|
||||
|
||||
Reference in New Issue
Block a user