From 6ae08bfbab7fd9443fb5bfdadef14c4df6fc8d4c Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Tue, 29 Dec 2015 14:30:24 -0500 Subject: [PATCH 1/3] Support optional headers in response send / json calls --- restify/restify.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index c523810ee..47c56240c 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -41,8 +41,8 @@ declare module "restify" { header: (key: string, value ?: any) => any; cache: (type?: any, options?: Object) => any; status: (code: number) => any; - send: (status?: any, body?: any) => any; - json: (status?: any, body?: any) => any; + send: (status?: any, body?: any, headers?: { [header: string]: string }) => any; + json: (status?: any, body?: any, headers?: { [header: string]: string }) => any; code: number; contentLength: number; charSet(value: string): void; From aeb8fefd8bcd341b61055145b4b26a7da79dd436 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Tue, 29 Dec 2015 14:44:13 -0500 Subject: [PATCH 2/3] Add definition for request files --- restify/restify.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 47c56240c..8baf5da2d 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -16,6 +16,11 @@ declare module "restify" { family: string; address: string; } + + interface requestFileInterface { + path: string; + type: string; + } interface Request extends http.ServerRequest { header: (key: string, defaultValue?: string) => any; @@ -34,6 +39,7 @@ declare module "restify" { params: any; body?: any; //available when bodyParser plugin is used + files?: { [name: string]: requestFileInterface }; isSecure: () => boolean; } From 9e4b7a31d54fb69111e00daedabc2473e8e19814 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Wed, 30 Dec 2015 12:24:56 -0500 Subject: [PATCH 3/3] Changes to support authorizationParser --- restify/restify.d.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 8baf5da2d..6fb2e6718 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -21,6 +21,18 @@ declare module "restify" { path: string; type: string; } + + /** + * Comes from authorizationParser plugin + */ + interface requestAuthorization { + scheme: string; + credentials: string; + basic?: { + username: string; + password: string; + } + } interface Request extends http.ServerRequest { header: (key: string, defaultValue?: string) => any; @@ -37,10 +49,14 @@ declare module "restify" { secure: boolean; time: number; params: any; - - body?: any; //available when bodyParser plugin is used files?: { [name: string]: requestFileInterface }; isSecure: () => boolean; + /** available when bodyParser plugin is used */ + body?: any; + /** available when authorizationParser plugin is used */ + username?: string; + /** available when authorizationParser plugin is used */ + authorization?: requestAuthorization; } interface Response extends http.ServerResponse {