UNPKG

@appwarden/middleware

Version:

Instantly disable all user interaction with your app deployed on Cloudflare or Vercel

27 lines (23 loc) 764 B
import { useContentSecurityPolicy } from "./chunk-CRDJAOJ7.js"; // src/utils/apply-content-security-policy-to-response.ts var applyContentSecurityPolicyToResponse = async ({ contentSecurityPolicy, ...context }) => { await useContentSecurityPolicy(contentSecurityPolicy)(context, async () => { }); return context.response; }; // src/utils/is-response-like.ts var isResponseLike = (value) => { if (!value || typeof value !== "object") return false; const candidate = value; const headers = candidate.headers; return !!(headers && typeof headers === "object" && typeof headers.has === "function" && typeof headers.set === "function" && typeof headers.get === "function"); }; export { applyContentSecurityPolicyToResponse, isResponseLike };