mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
[node] Add http[s] request/get variants for 10.9.0 (#28193)
This commit is contained in:
Vendored
+10
-6
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user