Skip to content

Commit eaaa5ef

Browse files
committed
User agent in the request
Signed-off-by: Vishal Rana <[email protected]>
1 parent 3f51b79 commit eaaa5ef

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/cube.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ const pusage = require('pidusage')
33
const got = require('got')
44

55
class Cube {
6-
constructor(key, options) {
6+
constructor(apiKey, options) {
77
this.url = 'https://api.labstack.com/cube'
8-
this.key = key
8+
this.apiKey = apiKey
99
options = options || {}
1010
this.node = options.node || os.hostname()
1111
this.batchSize = options.batchSize || 60
@@ -37,7 +37,8 @@ class Cube {
3737
// TODO: handler error
3838
got.post(this.url, {
3939
headers: {
40-
'Authorization': `Bearer ${this.key}`
40+
'User-Agent': 'labstack/cube',
41+
'Authorization': `Bearer ${this.apiKey}`
4142
},
4243
body: this.requests,
4344
json: true

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "labstack",
3-
"version": "0.21.1",
3+
"version": "0.21.2",
44
"description": "Official Node.js client library for the LabStack platform",
55
"main": "lib/index.js",
66
"scripts": {

test/express.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ app.use((err, req, res, next) => {
1717
next(err)
1818
})
1919

20-
app.listen(3001, () => console.log('Example app listening on port 3001!'))
20+
app.listen(3001)

0 commit comments

Comments
 (0)