docs: add missing headers option to ClientRequest options (#41723)

This commit is contained in:
Jeremy Rose 2024-03-28 09:38:16 -07:00 committed by GitHub
parent 72c2b9e862
commit c6102b9278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -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<string, string | string[]> (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)

View file

@ -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);