Skip to content

Commit 30c0020

Browse files
VoltrexKeyvadanielleadams
authored andcommitted
typings: add JSDoc typings for https
Added JSDoc typings for the `https` lib module. PR-URL: #38589 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 9ca5c0e commit 30c0020

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

lib/https.js

+71-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ ObjectSetPrototypeOf(Server, tls.Server);
9494

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

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

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

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

@@ -295,6 +330,11 @@ Agent.prototype._evictSession = function _evictSession(key) {
295330

296331
const globalAgent = new Agent();
297332

333+
/**
334+
* Makes a request to a secure web server.
335+
* @param {...any} args
336+
* @returns {ClientRequest}
337+
*/
298338
function request(...args) {
299339
let options = {};
300340

@@ -317,6 +357,36 @@ function request(...args) {
317357
return ReflectConstruct(ClientRequest, args);
318358
}
319359

360+
/**
361+
* Makes a GET request to a secure web server.
362+
* @param {string | URL} input
363+
* @param {{
364+
* agent?: Agent | boolean;
365+
* auth?: string;
366+
* createConnection?: Function;
367+
* defaultPort?: number;
368+
* family?: number;
369+
* headers?: Object;
370+
* hints?: number;
371+
* host?: string;
372+
* hostname?: string;
373+
* insecureHTTPParser?: boolean;
374+
* localAddress?: string;
375+
* localPort?: number;
376+
* lookup?: Function;
377+
* maxHeaderSize?: number;
378+
* method?: string;
379+
* path?: string;
380+
* port?: number;
381+
* protocol?: string;
382+
* setHost?: boolean;
383+
* socketPath?: string;
384+
* timeout?: number;
385+
* signal?: AbortSignal;
386+
* } | string | URL} [options]
387+
* @param {Function} [cb]
388+
* @returns {ClientRequest}
389+
*/
320390
function get(input, options, cb) {
321391
const req = request(input, options, cb);
322392
req.end();

0 commit comments

Comments
 (0)