🔧 Spec: Don’t use deprecated new Buffer()
This commit is contained in:
parent
f7d6e3fa7b
commit
0278e380de
6 changed files with 16 additions and 16 deletions
|
@ -28,7 +28,7 @@ describe('protocol module', () => {
|
|||
const body = stream.PassThrough()
|
||||
|
||||
async function sendChunks () {
|
||||
let buf = new Buffer(data)
|
||||
let buf = Buffer.from(data)
|
||||
for (;;) {
|
||||
body.push(buf.slice(0, chunkSize))
|
||||
buf = buf.slice(chunkSize)
|
||||
|
@ -204,7 +204,7 @@ describe('protocol module', () => {
|
|||
})
|
||||
|
||||
describe('protocol.registerBufferProtocol', () => {
|
||||
const buffer = new Buffer(text)
|
||||
const buffer = Buffer.from(text)
|
||||
it('sends Buffer as response', (done) => {
|
||||
const handler = (request, callback) => callback(buffer)
|
||||
protocol.registerBufferProtocol(protocolName, handler, (error) => {
|
||||
|
@ -767,7 +767,7 @@ describe('protocol module', () => {
|
|||
|
||||
describe('protocol.interceptBufferProtocol', () => {
|
||||
it('can intercept http protocol', (done) => {
|
||||
const handler = (request, callback) => callback(new Buffer(text))
|
||||
const handler = (request, callback) => callback(Buffer.from(text))
|
||||
protocol.interceptBufferProtocol('http', handler, (error) => {
|
||||
if (error) return done(error)
|
||||
$.ajax({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue