[node] Add http[s] request/get variants for 10.9.0 (#28193)

This commit is contained in:
Gerhard Stöbich
2018-08-23 10:41:25 -07:00
committed by Andy
parent 1d4d163c93
commit 374598de67
2 changed files with 46 additions and 6 deletions
+10 -6
View File
@@ -1,4 +1,4 @@
// Type definitions for Node.js 10.7.x
// Type definitions for Node.js 10.9.x
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>
// DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
@@ -186,11 +186,11 @@ interface String {
trimRight(): string;
}
/************************************************
* *
* GLOBAL *
* *
************************************************/
/*-----------------------------------------------*
* *
* GLOBAL *
* *
------------------------------------------------*/
declare var process: NodeJS.Process;
declare var global: NodeJS.Global;
declare var console: Console;
@@ -1289,7 +1289,9 @@ declare module "http" {
// create interface RequestOptions would make the naming more clear to developers
export interface RequestOptions extends ClientRequestArgs { }
export function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
export function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
export function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
export function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
export var globalAgent: Agent;
}
@@ -1891,7 +1893,9 @@ declare module "https" {
export function createServer(options: ServerOptions, requestListener?: (req: http.IncomingMessage, res: http.ServerResponse) => void): Server;
export function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
export function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
export function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
export function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
export var globalAgent: Agent;
}
+36
View File
@@ -1708,7 +1708,25 @@ namespace http_tests {
}
{
http.get('http://www.example.com/xyz');
http.request('http://www.example.com/xyz');
http.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
http.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
http.get(new url.URL('http://www.example.com/xyz'));
http.request(new url.URL('http://www.example.com/xyz'));
http.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
http.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
const opts: http.RequestOptions = {
path: '"/some/path'
};
http.get(new url.URL('http://www.example.com'), opts);
http.request(new url.URL('http://www.example.com'), opts);
http.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
http.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
}
{
@@ -1770,8 +1788,26 @@ namespace https_tests {
agent: undefined
});
https.get('http://www.example.com/xyz');
https.request('http://www.example.com/xyz');
https.get('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
https.request('http://www.example.com/xyz', (res: http.IncomingMessage): void => {});
https.get(new url.URL('http://www.example.com/xyz'));
https.request(new url.URL('http://www.example.com/xyz'));
https.get(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
https.request(new url.URL('http://www.example.com/xyz'), (res: http.IncomingMessage): void => {});
const opts: https.RequestOptions = {
path: '/some/path'
};
https.get(new url.URL('http://www.example.com'), opts);
https.request(new url.URL('http://www.example.com'), opts);
https.get(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
https.request(new url.URL('http://www.example.com/xyz'), opts, (res: http.IncomingMessage): void => {});
https.globalAgent.options.ca = [];
{