diff --git a/lib/as.js b/lib/as.js index 1825fb93..63927587 100644 --- a/lib/as.js +++ b/lib/as.js @@ -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; }