Skip to content

Commit 1597626

Browse files
alexahdpMylesBorins
authored andcommitted
net: replaced vars to lets and consts
PR-URL: #30287 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 5727bc3 commit 1597626

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎lib/_http_client.js‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function ClientRequest(input, options, cb) {
110110
options=Object.assign(input||{},options);
111111
}
112112

113-
varagent=options.agent;
113+
letagent=options.agent;
114114
constdefaultAgent=options._defaultAgent||Agent.globalAgent;
115115
if(agent===false){
116116
agent=newdefaultAgent.constructor();
@@ -128,11 +128,11 @@ function ClientRequest(input, options, cb) {
128128
this.agent=agent;
129129

130130
constprotocol=options.protocol||defaultAgent.protocol;
131-
varexpectedProtocol=defaultAgent.protocol;
131+
letexpectedProtocol=defaultAgent.protocol;
132132
if(this.agent&&this.agent.protocol)
133133
expectedProtocol=this.agent.protocol;
134134

135-
varpath;
135+
letpath;
136136
if(options.path){
137137
path=String(options.path);
138138
if(INVALID_PATH_REGEX.test(path))
@@ -157,7 +157,7 @@ function ClientRequest(input, options, cb) {
157157
if(options.timeout!==undefined)
158158
this.timeout=getTimerDuration(options.timeout,'timeout');
159159

160-
varmethod=options.method;
160+
letmethod=options.method;
161161
constmethodIsString=(typeofmethod==='string');
162162
if(method!==null&&method!==undefined&&!methodIsString){
163163
thrownewERR_INVALID_ARG_TYPE('method','string',method);
@@ -196,7 +196,7 @@ function ClientRequest(input, options, cb) {
196196
this.parser=null;
197197
this.maxHeadersCount=null;
198198

199-
varcalled=false;
199+
letcalled=false;
200200

201201
if(this.agent){
202202
// If there is an agent we should default to Connection:keep-alive,
@@ -215,20 +215,20 @@ function ClientRequest(input, options, cb) {
215215
constheadersArray=Array.isArray(options.headers);
216216
if(!headersArray){
217217
if(options.headers){
218-
varkeys=Object.keys(options.headers);
219-
for(vari=0;i<keys.length;i++){
220-
varkey=keys[i];
218+
constkeys=Object.keys(options.headers);
219+
for(leti=0;i<keys.length;i++){
220+
constkey=keys[i];
221221
this.setHeader(key,options.headers[key]);
222222
}
223223
}
224224

225225
if(host&&!this.getHeader('host')&&setHost){
226-
varhostHeader=host;
226+
lethostHeader=host;
227227

228228
// For the Host header, ensure that IPv6 addresses are enclosed
229229
// in square brackets, as defined by URI formatting
230230
// https://tools.ietf.org/html/rfc3986#section-3.2.2
231-
varposColon=hostHeader.indexOf(':');
231+
constposColon=hostHeader.indexOf(':');
232232
if(posColon!==-1&&
233233
hostHeader.includes(':',posColon+1)&&
234234
hostHeader.charCodeAt(0)!==91/* '[' */){
@@ -463,8 +463,8 @@ function socketOnData(d) {
463463
req.emit('error',ret);
464464
}elseif(parser.incoming&&parser.incoming.upgrade){
465465
// Upgrade (if status code 101) or CONNECT
466-
varbytesParsed=ret;
467-
varres=parser.incoming;
466+
constbytesParsed=ret;
467+
constres=parser.incoming;
468468
req.res=res;
469469

470470
socket.removeListener('data',socketOnData);
@@ -473,9 +473,9 @@ function socketOnData(d) {
473473
parser.finish();
474474
freeParser(parser,req,socket);
475475

476-
varbodyHead=d.slice(bytesParsed,d.length);
476+
constbodyHead=d.slice(bytesParsed,d.length);
477477

478-
vareventName=req.method==='CONNECT' ? 'connect' : 'upgrade';
478+
consteventName=req.method==='CONNECT' ? 'connect' : 'upgrade';
479479
if(req.listenerCount(eventName)>0){
480480
req.upgradeOrConnect=true;
481481

0 commit comments

Comments
 (0)