feat: log filter reason

This commit is contained in:
shiftinv 2022-09-03 20:13:06 +02:00
parent 31b66eb01a
commit c60a5ad871
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import { http } from "../deps.ts";
import { http, log } from "../deps.ts";
import { verify } from "./crypto.ts";
import filterWebhook from "./filter.ts";
import { UrlConfig } from "./types.d.ts";
@ -31,6 +31,7 @@ export default async function handle(req: Request): Promise<Response> {
// do the thing
const filterReason = filterWebhook(req.headers, json, urlConfig);
if (filterReason !== null) {
log.debug(`handler: ignored due to '${filterReason}'`);
return new Response(`Ignored by webhook filter (reason: ${filterReason})`, { status: 203 });
}