Skip to content

Commit e92a30a

Browse files
committed
use package version in user-agent string
1 parent bf4a5bc commit e92a30a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/main.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
var https = require('https');
44
var fs = require('fs');
5+
var pkg = require('./package.json');
6+
7+
var API_VERSION = 4;
58

69
// http://underscorejs.org/docs/underscore.html#section-118
710
function isObject(obj) {
@@ -59,8 +62,8 @@ module.exports = function(api_key) {
5962
method: method,
6063
headers: {
6164
'Authorization': auth,
62-
'Accept': 'application/vnd.blockscore+json;version=4',
63-
'User-Agent': 'blockscore-node/4.0.0 (https://github.com/BlockScore/blockscore-node)',
65+
'Accept': 'application/vnd.blockscore+json;version=' + API_VERSION,
66+
'User-Agent': 'blockscore-node/' + pkg.version + ' (https://github.com/BlockScore/blockscore-node)',
6467
'Content-Type': 'application/json',
6568
'Content-Length': request_data.length
6669
},
@@ -130,7 +133,7 @@ module.exports = function(api_key) {
130133
if (person_id && typeof person_id === 'string') {
131134
data = { person_id: person_id };
132135
} else if(person_id && isObject(person_id) && 'person_id' in person_id){
133-
data = person_id;
136+
data = person_id;
134137
} else {
135138
return cb(new Error("person_id required"));
136139
}
@@ -155,7 +158,7 @@ module.exports = function(api_key) {
155158
},
156159
del: function(candidate_id, cb) {
157160
del('/candidates/' + encodeURIComponent(candidate_id), {}, cb);
158-
},
161+
},
159162
retrieve: function(candidate_id, cb) {
160163
if (!(candidate_id && typeof candidate_id === 'string')) {
161164
return cb(new Error("candidate_id required"));

0 commit comments

Comments
 (0)