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
@@ -1,9 +1,10 @@
import { json } from '@sveltejs/kit';
import { jsonBody } from '$lib/server/request-body.js';
import { isHttpError, json } from '@sveltejs/kit';
import { previewCreation } from '$lib/server/provisioning/index.js';
export async function POST({ request }: { request: Request }) {
try {
const body = await request.json();
const body = await jsonBody(request);
if (!body || typeof body !== 'object' || Array.isArray(body))
throw new Error('Provide a launch selection.');
if (body.blueprintId !== undefined)
@@ -12,6 +13,7 @@ export async function POST({ request }: { request: Request }) {
);
return json(previewCreation(body));
} catch (err) {
if (isHttpError(err, 413)) throw err;
return json({ error: (err as Error).message }, { status: 400 });
}
}