test: add inbound route tests covering IP auth, validation, and R2 upload

This commit is contained in:
Julien Herr
2026-05-22 07:39:48 +02:00
parent e874906291
commit f2981eec31
2 changed files with 289 additions and 1 deletions
+7 -1
View File
@@ -14,7 +14,13 @@ export async function handle(c: Context): Promise<Response> {
contentType: payload.html ? "HTML" : "Text",
});
return handleForwardEmail(payload, env, c.executionCtx);
let ctx: ExecutionContext | undefined;
try {
ctx = c.executionCtx;
} catch {
// No ExecutionContext in this environment (e.g. tests); WebSub notifications will be skipped
}
return handleForwardEmail(payload, env, ctx);
} catch (error) {
console.error("Error processing email:", error);
return new Response("Error processing email", { status: 500 });