1
|
declare module "https" {
|
2
|
import * as tls from "tls";
|
3
|
import * as events from "events";
|
4
|
import * as http from "http";
|
5
|
import { URL } from "url";
|
6
|
|
7
|
type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions;
|
8
|
|
9
|
type RequestOptions = http.RequestOptions & tls.SecureContextOptions & {
|
10
|
rejectUnauthorized?: boolean; // Defaults to true
|
11
|
servername?: string; // SNI TLS Extension
|
12
|
};
|
13
|
|
14
|
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
|
15
|
rejectUnauthorized?: boolean;
|
16
|
maxCachedSessions?: number;
|
17
|
}
|
18
|
|
19
|
class Agent extends http.Agent {
|
20
|
constructor(options?: AgentOptions);
|
21
|
options: AgentOptions;
|
22
|
}
|
23
|
|
24
|
interface Server extends http.HttpBase {}
|
25
|
class Server extends tls.Server {
|
26
|
constructor(requestListener?: http.RequestListener);
|
27
|
constructor(options: ServerOptions, requestListener?: http.RequestListener);
|
28
|
}
|
29
|
|
30
|
function createServer(requestListener?: http.RequestListener): Server;
|
31
|
function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server;
|
32
|
function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
33
|
function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
34
|
function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
35
|
function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
36
|
let globalAgent: Agent;
|
37
|
}
|