docs: add missing headers option to ClientRequest options (#41723)
This commit is contained in:
parent
72c2b9e862
commit
c6102b9278
2 changed files with 4 additions and 3 deletions
|
@ -17,6 +17,8 @@ following properties:
|
||||||
method.
|
method.
|
||||||
* `url` string (optional) - The request URL. Must be provided in the absolute
|
* `url` string (optional) - The request URL. Must be provided in the absolute
|
||||||
form with the protocol scheme specified as http or https.
|
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
|
* `session` Session (optional) - The [`Session`](session.md) instance with
|
||||||
which the request is associated.
|
which the request is associated.
|
||||||
* `partition` string (optional) - The name of the [`partition`](session.md)
|
* `partition` string (optional) - The name of the [`partition`](session.md)
|
||||||
|
|
|
@ -935,12 +935,11 @@ describe('net module', () => {
|
||||||
response.end();
|
response.end();
|
||||||
});
|
});
|
||||||
const serverUrl = url.parse(serverUrlUnparsed);
|
const serverUrl = url.parse(serverUrlUnparsed);
|
||||||
const options = {
|
const urlRequest = net.request({
|
||||||
port: serverUrl.port ? parseInt(serverUrl.port, 10) : undefined,
|
port: serverUrl.port ? parseInt(serverUrl.port, 10) : undefined,
|
||||||
hostname: '127.0.0.1',
|
hostname: '127.0.0.1',
|
||||||
headers: { [customHeaderName]: customHeaderValue }
|
headers: { [customHeaderName]: customHeaderValue }
|
||||||
};
|
});
|
||||||
const urlRequest = net.request(options);
|
|
||||||
const response = await getResponse(urlRequest);
|
const response = await getResponse(urlRequest);
|
||||||
expect(response.statusCode).to.be.equal(200);
|
expect(response.statusCode).to.be.equal(200);
|
||||||
await collectStreamBody(response);
|
await collectStreamBody(response);
|
||||||
|
|
Loading…
Reference in a new issue