mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Chore: replace depracated 'new Buffer' with 'Buffer.from' (#2396)
See [Buffer](https://nodejs.org/docs/latest-v9.x/api/buffer.html) for more details
This commit is contained in:
committed by
Andrey Lushnikov
parent
b40e381f65
commit
ed4be10ae3
@@ -185,7 +185,7 @@ class SimpleServer {
|
||||
const pathName = url.parse(request.url).path;
|
||||
if (this._auths.has(pathName)) {
|
||||
const auth = this._auths.get(pathName);
|
||||
const credentials = new Buffer((request.headers.authorization || '').split(' ')[1] || '', 'base64').toString();
|
||||
const credentials = Buffer.from((request.headers.authorization || '').split(' ')[1] || '', 'base64').toString();
|
||||
if (credentials !== `${auth.username}:${auth.password}`) {
|
||||
response.writeHead(401, { 'WWW-Authenticate': 'Basic realm="Secure Area"' });
|
||||
response.end('HTTP Error 401 Unauthorized: Access is denied');
|
||||
|
||||
Reference in New Issue
Block a user