Bound request bodies and artifact uploads (Refs #94)
CI / checks (push) Successful in 4m34s

This commit is contained in:
2026-10-09 16:52:37 -04:00
parent 8fcb8312a3
commit 9eb3aa84c3
44 changed files with 603 additions and 79 deletions
+6 -2
View File
@@ -1,4 +1,5 @@
import { json } from '@sveltejs/kit';
import { jsonBody } from '$lib/server/request-body.js';
import { isHttpError, json } from '@sveltejs/kit';
import { watchdogDetail, updateWatchdogIncident } from '$lib/server/maintenance/recovery.js';
import { kick } from '$lib/server/pipeline/worker.js';
@@ -9,7 +10,10 @@ export function GET({ params }: { params: { id: string } }) {
: json({ error: 'Maintenance finding not found.' }, { status: 404 });
}
export async function POST({ params, request }: { params: { id: string }; request: Request }) {
const body = await request.json().catch(() => null);
const body = await jsonBody(request).catch((cause) => {
if (isHttpError(cause, 413)) throw cause;
return null;
});
if (!body || !['retry', 'dismiss'].includes(body.action))
return json({ error: 'Choose retry or dismiss.' }, { status: 400 });
const result = updateWatchdogIncident(params.id, body.action);