diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index bb0db64140..6074ce8284 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -595,15 +595,12 @@ export function auditLogger(options: { log: any }): (req: Request, res: Response export function fullResponse(): RequestHandler; // tslint:disable-next-line no-var export var defaultResponseHeaders: any; -export interface CORS { - (cors?: { - origins?: string[]; - credentials?: boolean; - headers?: string[]; - }): RequestHandler; - origins: string[]; - ALLOW_HEADERS: string[]; - credentials: boolean; + +export function CORS(options?: CORSOptions): RequestHandler; +export interface CORSOptions { + origins?: string[]; + credentials?: boolean; + headers?: string[]; } export const pre: { diff --git a/types/restify/restify-tests.ts b/types/restify/restify-tests.ts index 34db48ba0a..15eb8eb868 100644 --- a/types/restify/restify-tests.ts +++ b/types/restify/restify-tests.ts @@ -254,6 +254,11 @@ server.use(restify.queryParser()); server.use(restify.jsonp()); server.use(restify.gzipResponse()); server.use(restify.bodyParser()); +server.use(restify.CORS({ + origins: ['https://foo.com', 'http://bar.com', 'http://baz.com:8081'], + credentials: true, + headers: ['x-foo'] +})); server.use(restify.throttle({ burst: 100, rate: 50,