formatCacheControl
import { formatCacheControl } from "jsr:@ende/http/unstable-cache-control";function ยท experimental
function formatCacheControl(cc: CacheControl): stringSerializes a Cache-Control object to a header value string. Output is lowercase and comma-separated. Empty object produces an empty string.
An empty array for noCache or private is serialized as the bare
directive (e.g. no-cache), which parseCacheControl parses
back as true rather than [].
cc: CacheControlThe Cache-Control object (request or response).
Returns
The header value string, or empty string if no directives.
Example: Usage
import { formatCacheControl } from "@ende/http/unstable-cache-control";
import { assertEquals } from "@ende/assert";
const value = formatCacheControl({ maxAge: 300, mustRevalidate: true });
assertEquals(value, "max-age=300, must-revalidate");