From c6102b9278c81dfed3de3011f93d547921c41263 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Thu, 28 Mar 2024 09:38:16 -0700 Subject: [PATCH] docs: add missing headers option to ClientRequest options (#41723) --- docs/api/client-request.md | 2 ++ spec/api-net-spec.ts | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/api/client-request.md b/docs/api/client-request.md index 440a775267ca..7e2637d207b8 100644 --- a/docs/api/client-request.md +++ b/docs/api/client-request.md @@ -17,6 +17,8 @@ following properties: method. * `url` string (optional) - The request URL. Must be provided in the absolute form with the protocol scheme specified as http or https. + * `headers` Record (optional) - Headers to be sent + with the request. * `session` Session (optional) - The [`Session`](session.md) instance with which the request is associated. * `partition` string (optional) - The name of the [`partition`](session.md) diff --git a/spec/api-net-spec.ts b/spec/api-net-spec.ts index 1a92186742e1..c743632abcfb 100644 --- a/spec/api-net-spec.ts +++ b/spec/api-net-spec.ts @@ -935,12 +935,11 @@ describe('net module', () => { response.end(); }); const serverUrl = url.parse(serverUrlUnparsed); - const options = { + const urlRequest = net.request({ port: serverUrl.port ? parseInt(serverUrl.port, 10) : undefined, hostname: '127.0.0.1', headers: { [customHeaderName]: customHeaderValue } - }; - const urlRequest = net.request(options); + }); const response = await getResponse(urlRequest); expect(response.statusCode).to.be.equal(200); await collectStreamBody(response);