@@ -119,7 +119,7 @@ class ClientRequest extends EventEmitter {
119119 let urlStr = options . url
120120
121121 if ( ! urlStr ) {
122- let urlObj = { }
122+ const urlObj = { }
123123 const protocol = options . protocol || 'http:'
124124 if ( ! kSupportedProtocols . has ( protocol ) ) {
125125 throw new Error ( 'Protocol "' + protocol + '" not supported. ' )
@@ -149,7 +149,7 @@ class ClientRequest extends EventEmitter {
149149 // an invalid request.
150150 throw new TypeError ( 'Request path contains unescaped characters.' )
151151 }
152- let pathObj = url . parse ( options . path || '/' )
152+ const pathObj = url . parse ( options . path || '/' )
153153 urlObj . pathname = pathObj . pathname
154154 urlObj . search = pathObj . search
155155 urlObj . hash = pathObj . hash
@@ -161,7 +161,7 @@ class ClientRequest extends EventEmitter {
161161 throw new Error ( 'redirect mode should be one of follow, error or manual' )
162162 }
163163
164- let urlRequestOptions = {
164+ const urlRequestOptions = {
165165 method : method ,
166166 url : urlStr ,
167167 redirect : redirectPolicy
@@ -180,7 +180,7 @@ class ClientRequest extends EventEmitter {
180180 }
181181 }
182182
183- let urlRequest = new URLRequest ( urlRequestOptions )
183+ const urlRequest = new URLRequest ( urlRequestOptions )
184184
185185 // Set back and forward links.
186186 this . urlRequest = urlRequest
@@ -192,7 +192,7 @@ class ClientRequest extends EventEmitter {
192192 this . extraHeaders = { }
193193
194194 if ( options . headers ) {
195- for ( let key in options . headers ) {
195+ for ( const key in options . headers ) {
196196 this . setHeader ( key , options . headers [ key ] )
197197 }
198198 }
@@ -286,8 +286,8 @@ class ClientRequest extends EventEmitter {
286286 }
287287
288288 _write ( chunk , encoding , callback , isLast ) {
289- let chunkIsString = typeof chunk === 'string'
290- let chunkIsBuffer = chunk instanceof Buffer
289+ const chunkIsString = typeof chunk === 'string'
290+ const chunkIsBuffer = chunk instanceof Buffer
291291 if ( ! chunkIsString && ! chunkIsBuffer ) {
292292 throw new TypeError ( 'First argument must be a string or Buffer.' )
293293 }
@@ -306,7 +306,7 @@ class ClientRequest extends EventEmitter {
306306
307307 // Headers are assumed to be sent on first call to _writeBuffer,
308308 // i.e. after the first call to write or end.
309- let result = this . urlRequest . write ( chunk , isLast )
309+ const result = this . urlRequest . write ( chunk , isLast )
310310
311311 // The write callback is fired asynchronously to mimic Node.js.
312312 if ( callback ) {
@@ -318,7 +318,7 @@ class ClientRequest extends EventEmitter {
318318
319319 write ( data , encoding , callback ) {
320320 if ( this . urlRequest . finished ) {
321- let error = new Error ( 'Write after end.' )
321+ const error = new Error ( 'Write after end.' )
322322 process . nextTick ( writeAfterEndNT , this , error , callback )
323323 return true
324324 }
0 commit comments