Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Use Buffer.from()
Browse files Browse the repository at this point in the history
`new Buffer()` is deprecated and unsafe.
  • Loading branch information
TooTallNate committed Mar 3, 2018
1 parent 687da67 commit b7b7cc7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ HttpProxyAgent.prototype.callback = function connect (req, opts, fn) {
req.path = absolute;

// inject the `Proxy-Authorization` header if necessary
var auth = proxy.auth;
if (auth) {
req.setHeader('Proxy-Authorization', 'Basic ' + new Buffer(auth).toString('base64'));
if (proxy.auth) {
req.setHeader(
'Proxy-Authorization',
'Basic ' + Buffer.from(proxy.auth).toString('base64')
);
}

// create a socket connection to the proxy server
Expand Down

0 comments on commit b7b7cc7

Please sign in to comment.