Skip to content

Commit f4b397b

Browse files
committed
Merge pull request DefinitelyTyped#4477 from LeandroDG/patch-1
Adding basic authentication support and typed the response
2 parents f432cee + 292104d commit f4b397b

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

request/request.d.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,40 @@ declare module 'request' {
1515

1616
export = RequestAPI;
1717

18-
function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request;
19-
function RequestAPI(uri: string, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request;
20-
function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request;
18+
function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request;
19+
function RequestAPI(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request;
20+
function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request;
2121

2222
module RequestAPI {
2323
export function defaults(options: Options): typeof RequestAPI;
2424

25-
export function request(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
26-
export function request(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
27-
export function request(options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
25+
export function request(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
26+
export function request(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
27+
export function request(options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
2828

29-
export function get(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
30-
export function get(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
31-
export function get(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
29+
export function get(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
30+
export function get(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
31+
export function get(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
3232

33-
export function post(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
34-
export function post(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
35-
export function post(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
33+
export function post(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
34+
export function post(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
35+
export function post(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
3636

37-
export function put(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
38-
export function put(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
39-
export function put(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
37+
export function put(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
38+
export function put(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
39+
export function put(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
4040

41-
export function head(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
42-
export function head(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
43-
export function head(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
41+
export function head(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
42+
export function head(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
43+
export function head(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
4444

45-
export function patch(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
46-
export function patch(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
47-
export function patch(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
45+
export function patch(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
46+
export function patch(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
47+
export function patch(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
4848

49-
export function del(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
50-
export function del(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
51-
export function del(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
49+
export function del(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
50+
export function del(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
51+
export function del(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
5252

5353
export function forever(agentOptions: any, optionsArg: any): Request;
5454
export function jar(): CookieJar;
@@ -59,9 +59,10 @@ declare module 'request' {
5959
export interface Options {
6060
url?: string;
6161
uri?: string;
62-
callback?: (error: any, response: any, body: any) => void;
62+
callback?: (error: any, response: http.IncomingMessage, body: any) => void;
6363
jar?: any; // CookieJar
6464
form?: any; // Object or string
65+
auth?: AuthOptions;
6566
oauth?: OAuthOptions;
6667
aws?: AWSOptions;
6768
hawk ?: HawkOptions;
@@ -107,6 +108,7 @@ declare module 'request' {
107108
multipart(multipart: RequestPart[]): Request;
108109
json(val: any): Request;
109110
aws(opts: AWSOptions, now?: boolean): Request;
111+
auth(username: string, password: string, sendInmediately?: boolean, bearer?: string): Request;
110112
oauth(oauth: OAuthOptions): Request;
111113
jar(jar: CookieJar): Request;
112114

0 commit comments

Comments
 (0)