UNPKG

edge-master

Version:
42 lines (41 loc) 1.23 kB
import { IResponseInterceptor } from '../types/interceptor'; export interface CorsOptions { /** * Access-Control-Allow-Origin header value * Can be a string, array of strings, or a function that returns a string * @default '*' */ origin?: string | string[] | ((origin: string) => string); /** * Access-Control-Allow-Methods header value * @default 'GET, POST, PUT, DELETE, PATCH, OPTIONS' */ methods?: string | string[]; /** * Access-Control-Allow-Headers header value * @default '*' */ allowedHeaders?: string | string[]; /** * Access-Control-Expose-Headers header value */ exposedHeaders?: string | string[]; /** * Access-Control-Max-Age header value (in seconds) * @default 86400 (24 hours) */ maxAge?: number; /** * Access-Control-Allow-Credentials header value * @default false */ credentials?: boolean; } /** * Creates a CORS interceptor with the specified options */ export declare function corsInterceptor(options?: CorsOptions): IResponseInterceptor; /** * Creates a simple CORS interceptor that allows all origins */ export declare function corsAllowAll(): IResponseInterceptor;