kinetex - v1.0.0-rc.1
    Preparing search index...

    Function corsHeaders

    • Build standard CORS headers.

      This function sets headers unconditionally. If you need to merge with pre-existing CORS headers, use the returned HttpHeaders as a base and then apply additional headers after. Do not use Object.assign() or merge functions that may overwrite the Access-Control-Allow-Origin set here.

      Parameters

      • options: {
            origin: string | string[];
            methods?: string[];
            allowHeaders?: string[];
            exposeHeaders?: string[];
            credentials?: boolean;
            maxAge?: number;
        }

      Returns HttpHeaders

      // As a base - caller adds the rest
      const base = corsHeaders({ origin: "https://example.com" });
      base.set("Access-Control-Allow-Methods", "GET, POST");