1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Description: replace Buffer() by Buffer.from()
Author: Xavier Guimard <yadd@debian.org>
Forwarded: no
Last-Update: 2020-03-01
--- a/lib/node-rest-client.js
+++ b/lib/node-rest-client.js
@@ -64,7 +64,7 @@
var result ={};
// if proxy requires authentication, create Proxy-Authorization headers
if (self.proxy.user && self.proxy.password){
- result["Proxy-Authorization"] = "Basic " + new Buffer([self.proxy.user,self.proxy.password].join(":")).toString("base64");
+ result["Proxy-Authorization"] = "Basic " + new Buffer.from([self.proxy.user,self.proxy.password].join(":")).toString("base64");
}
// no tunnel proxy connection, we add the host to the headers
if(!self.useProxyTunnel)
@@ -497,7 +497,7 @@
// concurrent data chunk handler
res.on('data',function(chunk){
- buffer.push(new Buffer(chunk));
+ buffer.push(new Buffer.from(chunk));
});
res.on('end',function(){
@@ -583,7 +583,7 @@
// concurrent data chunk handler
res.on('data',function(chunk){
- buffer.push(new Buffer(chunk));
+ buffer.push(new Buffer.from(chunk));
});
res.on('end',function(){
|