Skip to content

Commit 58154ce

Browse files
VoltrexKeyvarichardlau
authored andcommitted
typings: add JSDoc typings for https
Added JSDoc typings for the `https` lib module. PR-URL: #38589 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 55ea29e commit 58154ce

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

lib/https.js

+72-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ ObjectSetPrototypeOf(Server, tls.Server);
9595

9696
Server.prototype.setTimeout = HttpServer.prototype.setTimeout;
9797

98+
/**
99+
* Creates a new `https.Server` instance.
100+
* @param {{
101+
* IncomingMessage?: IncomingMessage;
102+
* ServerResponse?: ServerResponse;
103+
* insecureHTTPParser?: boolean;
104+
* maxHeaderSize?: number;
105+
* }} [opts]
106+
* @param {Function} [requestListener]
107+
* @returns {Server}
108+
*/
98109
function createServer(opts, requestListener) {
99110
return new Server(opts, requestListener);
100111
}
@@ -152,7 +163,21 @@ function createConnection(port, host, options) {
152163
return socket;
153164
}
154165

155-
166+
/**
167+
* Creates a new `HttpAgent` instance.
168+
* @param {{
169+
* keepAlive?: boolean;
170+
* keepAliveMsecs?: number;
171+
* maxSockets?: number;
172+
* maxTotalSockets?: number;
173+
* maxFreeSockets?: number;
174+
* scheduling?: string;
175+
* timeout?: number;
176+
* maxCachedSessions?: number;
177+
* servername?: string;
178+
* }} [options]
179+
* @returns {Agent}
180+
*/
156181
function Agent(options) {
157182
if (!(this instanceof Agent))
158183
return new Agent(options);
@@ -173,6 +198,16 @@ ObjectSetPrototypeOf(Agent.prototype, HttpAgent.prototype);
173198
ObjectSetPrototypeOf(Agent, HttpAgent);
174199
Agent.prototype.createConnection = createConnection;
175200

201+
/**
202+
* Gets a unique name for a set of options.
203+
* @param {{
204+
* host: string;
205+
* port: number;
206+
* localAddress: string;
207+
* family: number;
208+
* }} [options]
209+
* @returns {string}
210+
*/
176211
Agent.prototype.getName = function getName(options) {
177212
let name = FunctionPrototypeCall(HttpAgent.prototype.getName, this, options);
178213

@@ -297,6 +332,12 @@ Agent.prototype._evictSession = function _evictSession(key) {
297332
const globalAgent = new Agent();
298333

299334
let urlWarningEmitted = false;
335+
336+
/**
337+
* Makes a request to a secure web server.
338+
* @param {...any} args
339+
* @returns {ClientRequest}
340+
*/
300341
function request(...args) {
301342
let options = {};
302343

@@ -333,6 +374,36 @@ function request(...args) {
333374
return ReflectConstruct(ClientRequest, args);
334375
}
335376

377+
/**
378+
* Makes a GET request to a secure web server.
379+
* @param {string | URL} input
380+
* @param {{
381+
* agent?: Agent | boolean;
382+
* auth?: string;
383+
* createConnection?: Function;
384+
* defaultPort?: number;
385+
* family?: number;
386+
* headers?: Object;
387+
* hints?: number;
388+
* host?: string;
389+
* hostname?: string;
390+
* insecureHTTPParser?: boolean;
391+
* localAddress?: string;
392+
* localPort?: number;
393+
* lookup?: Function;
394+
* maxHeaderSize?: number;
395+
* method?: string;
396+
* path?: string;
397+
* port?: number;
398+
* protocol?: string;
399+
* setHost?: boolean;
400+
* socketPath?: string;
401+
* timeout?: number;
402+
* signal?: AbortSignal;
403+
* } | string | URL} [options]
404+
* @param {Function} [cb]
405+
* @returns {ClientRequest}
406+
*/
336407
function get(input, options, cb) {
337408
const req = request(input, options, cb);
338409
req.end();

0 commit comments

Comments
 (0)