/** * RFC 9110 weak comparison for a GET/HEAD `If-None-Match` precondition, shared by the host-owned * asset routes that answer `304` against a strong validator they computed from their own bytes. */ export function etagMatches(headerValue: string | undefined, etag: string): boolean { if (headerValue === undefined) { return false; } if (headerValue.trim() === "*") { return true; } return headerValue.split(",").some((candidate) => { const value = candidate.trim(); return (value.startsWith("W/") ? value.slice(2) : value) === etag; }); }