import { Status, STATUS_TEXT } from "./http_status.ts";import { deepMerge } from "../collections/deep_merge.ts";
export function compareEtag(a: string, b: string): boolean { if (a === b) { return true; } if (a.startsWith("W/") && !b.startsWith("W/")) { return a.slice(2) === b; } if (!a.startsWith("W/") && b.startsWith("W/")) { return a === b.slice(2); } return false;}
export function createCommonResponse( status: Status, body?: BodyInit | null, init?: ResponseInit,): Response { if (body === undefined) { body = STATUS_TEXT[status]; } init = deepMerge({ status, statusText: STATUS_TEXT[status], }, init ?? {}); return new Response(body, init);}