export interface CorsOptions { /** * Which origins are allowed. `'*'` allows any (not permitted with * `credentials: true`). A string/array is matched exactly; a RegExp is tested; * a function receives the request `Origin` and returns whether it is allowed. */ origin: string | string[] | RegExp | ((origin: string) => boolean); /** Allowed methods for preflight. Defaults to the common verb set. */ methods?: string[]; /** Allowed request headers for preflight. Defaults to reflecting the request's `Access-Control-Request-Headers`. */ headers?: string[]; /** Send `Access-Control-Allow-Credentials: true`. Incompatible with `origin: '*'`. */ credentials?: boolean; /** Preflight cache duration in seconds (`Access-Control-Max-Age`). */ maxAge?: number; /** Response headers exposed to the browser (`Access-Control-Expose-Headers`). */ exposeHeaders?: string[]; } /** Normalize the `cors` option; validates the credentials + wildcard rule. */ export declare const normalizeCorsOptions: (option: boolean | CorsOptions) => CorsOptions | undefined; /** * Resolve the `Access-Control-Allow-Origin` value for a request, or `null` when * the origin is not allowed (no CORS headers should be emitted). */ export declare const resolveAllowedOrigin: (options: CorsOptions, requestOrigin: string | null) => string | null; /** Whether a request is a CORS preflight (`OPTIONS` + `Access-Control-Request-Method`). */ export declare const isPreflight: (request: Request) => boolean; /** * Build the 204 preflight response, or `null` when the origin is not allowed * (the caller should fall through to normal handling / 404). */ export declare const buildPreflightResponse: (options: CorsOptions, request: Request) => Response | null; /** * Apply CORS response headers to a resolved response. Returns the response * unchanged when there is no `Origin` header or the origin is disallowed. */ export declare const applyCorsHeaders: (options: CorsOptions, request: Request, response: Response) => Response; //# sourceMappingURL=cors.d.ts.map