[node] add setHost to http.ClientRequestArgs

This commit is contained in:
Gerhard Stoebich 2018-12-14 14:24:13 +01:00
parent 6def4dbaaa
commit 73df157ff4
2 changed files with 2 additions and 0 deletions

View File

@ -1194,6 +1194,7 @@ declare module "http" {
agent?: Agent | boolean;
_defaultAgent?: Agent;
timeout?: number;
setHost?: boolean;
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: net.Socket) => void) => net.Socket;
}

View File

@ -1940,6 +1940,7 @@ async function asyncStreamPipelineFinished() {
let req: http.ClientRequest = new http.ClientRequest("https://www.google.com");
req = new http.ClientRequest(new url.URL("https://www.google.com"));
req = new http.ClientRequest({ path: 'http://0.0.0.0' });
req = new http.ClientRequest({ setHost: false });
// header
req.setHeader('Content-Type', 'text/plain');