Skip to content

Commit

Permalink
Instead of new Buffer using Buffer.from as per https://nodejs.org/api…
Browse files Browse the repository at this point in the history
  • Loading branch information
Bharat Mhaskar authored and monkpow committed Sep 4, 2023
1 parent 257415e commit 0122595
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/as.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ function asBuffer(body, options) {
if (Buffer.isBuffer(body)) {
ret = body;
} else if (typeof body === 'object') {
ret = new Buffer(JSON.stringify(body), options.reqBodyEncoding);
ret = Buffer.from(JSON.stringify(body), options.reqBodyEncoding);
} else if (typeof body === 'string') {
ret = new Buffer(body, options.reqBodyEncoding);
ret = Buffer.from(body, options.reqBodyEncoding);
}
return ret;
}
Expand Down

0 comments on commit 0122595

Please sign in to comment.