All files / src/lib/seo city-not-found.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17                      3x 3x 3x 3x    
import type { AstroGlobal } from "astro";
 
/**
 * Branded 404 for `/interiors/*` routes. Renders the site's 404 page
 * (header, footer, "Go Home") instead of a bare "Not found" string, and
 * marks it `no-store`: a city that is not live yet must not sit behind a
 * cached 404 once its first designer is published.
 */
export async function cityNotFound(
	astro: Pick<AstroGlobal, "rewrite">,
): Promise<Response> {
	const page = await astro.rewrite("/404");
	const headers = new Headers(page.headers);
	headers.set("Cache-Control", "no-store");
	return new Response(page.body, { status: 404, headers });
}