Skip to content

Commit f320b64

Browse files
committed
fix [DEP0005] DeprecationWarning
Buffer() is deprecated due to security and usability issues. It is suggested to use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. Also discussed in spdy-http2#5
1 parent ed1ad41 commit f320b64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/deceiver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ Deceiver.prototype.emitBody = function emitBody (buffer) {
247247

248248
Deceiver.prototype._emitEmpty = function _emitEmpty () {
249249
// Emit data to force out handling of UPGRADE
250-
var empty = new Buffer(0)
250+
var empty = Buffer.alloc ? Buffer.alloc(0) : new Buffer(0)
251251
if (this.socket.ondata) { this.socket.ondata(empty, 0, 0) } else {
252252
this.socket.emit('data', empty)
253253
}

0 commit comments

Comments
 (0)