---
/**
 * ALS request context test — validates AsyncLocalStorage propagation
 * from EmDash middleware through Astro's render pipeline on workerd.
 *
 * Test:
 *   curl http://localhost:4321/als-test
 *     → hasContext: false (fast path, no ALS)
 *
 *   curl -b "emdash-edit-mode=true" http://localhost:4321/als-test
 *     → hasContext: true, editMode: false (no auth)
 *
 * Remove this page once validated.
 */
import { getRequestContext } from "emdash/request-context";

const ctx = getRequestContext();
---

<html>
	<head><title>ALS Test (Cloudflare)</title></head>
	<body>
		<h1>ALS Request Context Test</h1>
		<pre
			id="result">{JSON.stringify({
    hasContext: ctx !== undefined,
    editMode: ctx?.editMode ?? false,
    preview: ctx?.preview ?? null,
  }, null, 2)}</pre>
	</body>
</html>
