Item Detail: {data.slug}
+Request ID: {data.requestId}
Hello, {data.visitor}!
+Runtime: {data.runtime} | Request ID: {data.requestId} | Theme: {data.theme} | KV Page Views: {data.hits}
Updated theme to: {form.theme}
+ {/if} +req-slice-edge`)
+ ) {
+ dynamicSlugPagesRendered++;
+ }
+ digestParts.push(`slug:${res.status}:${slug}`);
+ }
+
+ // 3. Dispatch 2 Form Action POST `/?/setTheme` requests
+ for (let i = 0; i < 2; i++) {
+ const nextTheme = THEMES[(i + 1) % THEMES.length];
+ const req = new Request("https://edge.slice.local/?/setTheme", {
+ method: "POST",
+ headers: {
+ Origin: "https://edge.slice.local",
+ "Content-Type": "application/x-www-form-urlencoded",
+ Accept: "application/json"
+ },
+ body: `theme=${nextTheme}`
+ });
+ const res = await sliceEntry.fetch(req, {}, {});
+ totalRequestsDispatched++;
+ if (res.status === 200) status200Count++;
+ const setCookie = res.headers.get("set-cookie") || "";
+ if (setCookie.includes(`theme=${nextTheme}`)) {
+ cookiesIssued++;
+ }
+ const actionJson = (await res.json()) as { type: string; status: number; data: string };
+ if (actionJson.type === "success" && actionJson.data.includes(nextTheme)) {
+ formActionsExecuted++;
+ }
+ digestParts.push(`action:${res.status}:${actionJson.type}:${nextTheme}`);
+ }
+
+ // 4. Dispatch 1 Client-Side Data Navigation GET `/__data.json?name=Navigator`
+ {
+ const req = new Request("https://edge.slice.local/__data.json?name=Navigator", {
+ method: "GET"
+ });
+ const res = await sliceEntry.fetch(req, {}, {});
+ totalRequestsDispatched++;
+ if (res.status === 200) status200Count++;
+ const dataText = await res.text();
+ if (dataText.includes(`"Navigator"`) && dataText.includes(`"WinterTC-Edge-Isolate"`)) {
+ clientDataLoads++;
+ }
+ digestParts.push(`data:${res.status}:${clientDataLoads}`);
+ }
+
+ // 5. Dispatch 1 GET `/api/items?tag=edge` and 1 POST `/api/items`
+ {
+ const getReq = new Request("https://edge.slice.local/api/items?tag=edge", {
+ method: "GET"
+ });
+ const getRes = await sliceEntry.fetch(getReq, {}, {});
+ totalRequestsDispatched++;
+ if (getRes.status === 200) status200Count++;
+ const getBody = (await getRes.json()) as { ok: boolean; tag: string; count: number };
+ digestParts.push(`api-get:${getRes.status}:${getBody.tag}:${getBody.count}`);
+
+ const postReq = new Request("https://edge.slice.local/api/items", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ item: "sveltekit-5-cas" })
+ });
+ const postRes = await sliceEntry.fetch(postReq, {}, {});
+ totalRequestsDispatched++;
+ if (postRes.status === 201) status201Count++;
+ const postBody = (await postRes.json()) as { created: boolean; count: number };
+ digestParts.push(`api-post:${postRes.status}:${postBody.created}:${postBody.count}`);
+ }
+
+ // 6. Dispatch 1 unknown route probe (expect 404 `+error.svelte` SSR fallback)
+ {
+ const notFoundReq = new Request("https://edge.slice.local/non-existent-sveltekit-route", {
+ method: "GET"
+ });
+ const notFoundRes = await sliceEntry.fetch(notFoundReq, {}, {});
+ totalRequestsDispatched++;
+ if (notFoundRes.status === 404) status404Count++;
+ const errHtml = await notFoundRes.text();
+ const has404Markup = errHtml.includes("Hello, {data.visitor}!
+Runtime: {data.runtime} | Request ID: {data.requestId} | Theme: {data.theme} | KV Page Views: {data.hits}
Updated theme to: {form.theme}
+ {/if} +Request ID: {data.requestId}