Skip to content

Commit

Permalink
Replace new Buffer() use with Buffer.from()
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Mar 2, 2017
1 parent 67386be commit 0e40671
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/client.js
Expand Up @@ -68,7 +68,7 @@ class Client {
}

auth_header () {
const api_key_base64 = new Buffer(this.options.api_key).toString('base64')
const api_key_base64 = Buffer.from(this.options.api_key).toString('base64')
return `Basic ${api_key_base64}`
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/actions.test.js
Expand Up @@ -194,7 +194,7 @@ test('create a new action with buffer body', t => {
t.plan(4)
const ns = '_'
const client = {}
const action = new Buffer('some action source contents')
const action = Buffer.from('some action source contents')
const actions = new Actions(client)

client.request = (method, path, options) => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/client.test.js
Expand Up @@ -94,7 +94,7 @@ test('should return request parameters with explicit api option', t => {
test('should generate auth header from API key', t => {
const api_key = 'some sample api key'
const client = new Client({api: true, api_key: api_key})
t.is(client.auth_header(), `Basic ${new Buffer(api_key).toString('base64')}`)
t.is(client.auth_header(), `Basic ${Buffer.from(api_key).toString('base64')}`)
})

test('should throw errors for HTTP response failures', t => {
Expand Down

0 comments on commit 0e40671

Please sign in to comment.