@@ -181,7 +181,7 @@ module.exports = {
181
181
var user = 'foo' ;
182
182
var headers = { Authorization : 'Bearer 1234' } ;
183
183
axios . get ( 'http://' + user + '@localhost:4444/' , { headers : headers } ) . then ( function ( res ) {
184
- var base64 = new Buffer ( user + ':' , 'utf8' ) . toString ( 'base64' ) ;
184
+ var base64 = Buffer . from ( user + ':' , 'utf8' ) . toString ( 'base64' ) ;
185
185
test . equal ( res . data , 'Basic ' + base64 ) ;
186
186
test . done ( ) ;
187
187
} ) ;
@@ -195,7 +195,7 @@ module.exports = {
195
195
var auth = { username : 'foo' , password : 'bar' } ;
196
196
var headers = { Authorization : 'Bearer 1234' } ;
197
197
axios . get ( 'http://localhost:4444/' , { auth : auth , headers : headers } ) . then ( function ( res ) {
198
- var base64 = new Buffer ( 'foo:bar' , 'utf8' ) . toString ( 'base64' ) ;
198
+ var base64 = Buffer . from ( 'foo:bar' , 'utf8' ) . toString ( 'base64' ) ;
199
199
test . equal ( res . data , 'Basic ' + base64 ) ;
200
200
test . done ( ) ;
201
201
} ) ;
@@ -288,7 +288,7 @@ module.exports = {
288
288
} ,
289
289
290
290
testBuffer : function ( test ) {
291
- var buf = new Buffer ( 1024 ) ; // Unsafe buffer < Buffer.poolSize (8192 bytes)
291
+ var buf = Buffer . from ( 1024 ) ; // Unsafe buffer < Buffer.poolSize (8192 bytes)
292
292
buf . fill ( 'x' ) ;
293
293
server = http . createServer ( function ( req , res ) {
294
294
test . equal ( req . headers [ 'content-length' ] , buf . length . toString ( ) ) ;
@@ -437,7 +437,7 @@ module.exports = {
437
437
}
438
438
}
439
439
} ) . then ( function ( res ) {
440
- var base64 = new Buffer ( 'user:pass' , 'utf8' ) . toString ( 'base64' ) ;
440
+ var base64 = Buffer . from ( 'user:pass' , 'utf8' ) . toString ( 'base64' ) ;
441
441
test . equal ( res . data , 'Basic ' + base64 , 'should authenticate to the proxy' ) ;
442
442
test . done ( ) ;
443
443
} ) ;
@@ -473,7 +473,7 @@ module.exports = {
473
473
process . env . http_proxy = 'http://user:pass@localhost:4000/' ;
474
474
475
475
axios . get ( 'http://localhost:4444/' ) . then ( function ( res ) {
476
- var base64 = new Buffer ( 'user:pass' , 'utf8' ) . toString ( 'base64' ) ;
476
+ var base64 = Buffer . from ( 'user:pass' , 'utf8' ) . toString ( 'base64' ) ;
477
477
test . equal ( res . data , 'Basic ' + base64 , 'should authenticate to the proxy set by process.env.http_proxy' ) ;
478
478
test . done ( ) ;
479
479
} ) ;
@@ -519,7 +519,7 @@ module.exports = {
519
519
'Proxy-Authorization' : 'Basic abc123'
520
520
}
521
521
} ) . then ( function ( res ) {
522
- var base64 = new Buffer ( 'user:pass' , 'utf8' ) . toString ( 'base64' ) ;
522
+ var base64 = Buffer . from ( 'user:pass' , 'utf8' ) . toString ( 'base64' ) ;
523
523
test . equal ( res . data , 'Basic ' + base64 , 'should authenticate to the proxy' ) ;
524
524
test . done ( ) ;
525
525
} ) ;
0 commit comments