Skip to content

Commit 1ed517c

Browse files
mcgittydanielleadams
authored andcommitted
doc: document return value of https.request
Add missing topic about what https.request() returns. PR-URL: #36370 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Pooja D P <[email protected]>
1 parent b367d5a commit 1ed517c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/https.md

+6
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ changes:
275275
* `port` **Default:** `443`
276276
* `agent` **Default:** `https.globalAgent`
277277
* `callback` {Function}
278+
* Returns: {http.ClientRequest}
278279

279280
Makes a request to a secure web server.
280281

@@ -288,6 +289,10 @@ The following additional `options` from [`tls.connect()`][] are also accepted:
288289
string, it is automatically parsed with [`new URL()`][]. If it is a [`URL`][]
289290
object, it will be automatically converted to an ordinary `options` object.
290291

292+
`https.request()` returns an instance of the [`http.ClientRequest`][]
293+
class. The `ClientRequest` instance is a writable stream. If one needs to
294+
upload a file with a POST request, then write to the `ClientRequest` object.
295+
291296
```js
292297
const https = require('https');
293298

@@ -458,6 +463,7 @@ headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; p
458463
[`URL`]: url.md#url_the_whatwg_url_api
459464
[`http.Agent(options)`]: http.md#http_new_agent_options
460465
[`http.Agent`]: http.md#http_class_http_agent
466+
[`http.ClientRequest`]: http.md#http_class_http_clientrequest
461467
[`http.Server#headersTimeout`]: http.md#http_server_headerstimeout
462468
[`http.Server#keepAliveTimeout`]: http.md#http_server_keepalivetimeout
463469
[`http.Server#maxHeadersCount`]: http.md#http_server_maxheaderscount

0 commit comments

Comments
 (0)