mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 10:35:22 +08:00
Merge pull request #16514 from fortuna/master
Fix CORS definition on restify
This commit is contained in:
15
types/restify/index.d.ts
vendored
15
types/restify/index.d.ts
vendored
@@ -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: {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user