Skip to content

Commit

Permalink
Use new Buffer instead of Buffer.from
Browse files Browse the repository at this point in the history
This is currently breaking Travis. Yes, I know these are deprecated! However, they're not dangerous. Will fix at some point in the future.
  • Loading branch information
mhart committed Mar 25, 2018
1 parent 4019d70 commit c655ea4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@ function sendJson(req, res, data, statusCode) {
function sendCborUnknown(req, res) {
res.setHeader('Content-Type', 'application/x-amz-cbor-1.1')
return sendRaw(req, res, Buffer.concat([
Buffer.from('bf66', 'hex'),
Buffer.from('__type', 'utf8'),
Buffer.from('7819', 'hex'),
Buffer.from('UnknownOperationException', 'utf8'),
Buffer.from('ff', 'hex'),
new Buffer('bf66', 'hex'),
new Buffer('__type', 'utf8'),
new Buffer('7819', 'hex'),
new Buffer('UnknownOperationException', 'utf8'),
new Buffer('ff', 'hex'),
]), 400)
}

function sendCborSerialization(req, res) {
res.setHeader('Content-Type', 'application/x-amz-cbor-1.1')
return sendRaw(req, res, Buffer.concat([
Buffer.from('bf66', 'hex'),
Buffer.from('__type', 'utf8'),
Buffer.from('76', 'hex'),
Buffer.from('SerializationException', 'utf8'),
Buffer.from('ff', 'hex'),
new Buffer('bf66', 'hex'),
new Buffer('__type', 'utf8'),
new Buffer('76', 'hex'),
new Buffer('SerializationException', 'utf8'),
new Buffer('ff', 'hex'),
]), 400)
}

Expand Down
22 changes: 11 additions & 11 deletions test/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function assertBody(statusCode, contentType, body, done) {
}
if (!Buffer.isBuffer(res.body)) {
if (typeof res.body != 'string') res.body = JSON.stringify(res.body)
res.body = Buffer.from(res.body, 'utf8')
res.body = new Buffer(res.body, 'utf8')
}
res.headers['content-length'].should.equal(String(res.body.length))
res.headers['x-amzn-requestid'].should.match(uuidRegex)
Expand Down Expand Up @@ -82,11 +82,11 @@ function assertUnknownDeprecated(done) {

function assertUnknownCbor(done) {
return assertBody(400, 'application/x-amz-cbor-1.1', Buffer.concat([
Buffer.from('bf66', 'hex'),
Buffer.from('__type', 'utf8'),
Buffer.from('7819', 'hex'),
Buffer.from('UnknownOperationException', 'utf8'),
Buffer.from('ff', 'hex')
new Buffer('bf66', 'hex'),
new Buffer('__type', 'utf8'),
new Buffer('7819', 'hex'),
new Buffer('UnknownOperationException', 'utf8'),
new Buffer('ff', 'hex')
]), done)
}

Expand All @@ -103,11 +103,11 @@ function assertSerializationDeprecated(done) {

function assertSerializationCbor(done) {
return assertBody(400, 'application/x-amz-cbor-1.1', Buffer.concat([
Buffer.from('bf66', 'hex'),
Buffer.from('__type', 'utf8'),
Buffer.from('76', 'hex'),
Buffer.from('SerializationException', 'utf8'),
Buffer.from('ff', 'hex')
new Buffer('bf66', 'hex'),
new Buffer('__type', 'utf8'),
new Buffer('76', 'hex'),
new Buffer('SerializationException', 'utf8'),
new Buffer('ff', 'hex')
]), done)
}

Expand Down

0 comments on commit c655ea4

Please sign in to comment.