eugef / node-mocks-http

Mock 'http' objects for testing Express,js, Next.js and Koa routing functions
Other
755 stars 134 forks source link

Remove calls to deprecated Buffer constructors #221

Closed sergioregueira closed 4 years ago

sergioregueira commented 4 years ago

Constructors new Buffer(string) and new Buffer(size) have been deprecated a long time ago.

npm run test emits a DeprecationWarning because the library uses it for both implementation and unit tests.

(node:2104) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

This pull request replaces those deprecated methods with the new recommended ones.