From 12dc0e6a28ec0a5e73b53d032cca1fc2f2c7ef7f Mon Sep 17 00:00:00 2001 From: Michael Chen <4326639+mcgitty@users.noreply.github.com> Date: Thu, 3 Dec 2020 11:40:58 -0800 Subject: [PATCH] doc: document return value of https.request Add missing topic about what https.request() returns. PR-URL: https://github.com/nodejs/node/pull/36370 Reviewed-By: Rich Trott Reviewed-By: Pooja D P --- doc/api/https.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/https.md b/doc/api/https.md index ae019684ba18df..f7cc2a340101e7 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -273,6 +273,7 @@ changes: * `port` **Default:** `443` * `agent` **Default:** `https.globalAgent` * `callback` {Function} +* Returns: {http.ClientRequest} Makes a request to a secure web server. @@ -286,6 +287,10 @@ The following additional `options` from [`tls.connect()`][] are also accepted: string, it is automatically parsed with [`new URL()`][]. If it is a [`URL`][] object, it will be automatically converted to an ordinary `options` object. +`https.request()` returns an instance of the [`http.ClientRequest`][] +class. The `ClientRequest` instance is a writable stream. If one needs to +upload a file with a POST request, then write to the `ClientRequest` object. + ```js const https = require('https'); @@ -456,6 +461,7 @@ headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; p [`URL`]: url.md#url_the_whatwg_url_api [`http.Agent(options)`]: http.md#http_new_agent_options [`http.Agent`]: http.md#http_class_http_agent +[`http.ClientRequest`]: http.md#http_class_http_clientrequest [`http.Server#headersTimeout`]: http.md#http_server_headerstimeout [`http.Server#keepAliveTimeout`]: http.md#http_server_keepalivetimeout [`http.Server#maxHeadersCount`]: http.md#http_server_maxheaderscount