mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-22 11:40:10 +08:00
Merge pull request #7392 from jocull/restify
Support optional headers in response send / json calls, requested files, authorizationParser
This commit is contained in:
Vendored
+26
-4
@@ -16,6 +16,23 @@ declare module "restify" {
|
||||
family: string;
|
||||
address: string;
|
||||
}
|
||||
|
||||
interface requestFileInterface {
|
||||
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;
|
||||
@@ -32,17 +49,22 @@ 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 {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user