Skip to content

Commit 2a87e82

Browse files
authored
Merge pull request #16 from Moesif/allow-useragent-to-be-set
Refactor: Allow User-Agent to be set by the middleware
2 parents b4913c5 + 2517230 commit 2a87e82

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

lib/Controllers/ApiController.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66

77
var _request = require('../Http/Client/RequestClient'),
88
_configuration = require('../configuration'),
9-
_APIHelper = require('../APIHelper'),
10-
pjson = require('../../package.json');
9+
_APIHelper = require('../APIHelper');
1110

1211
function buildHeaders() {
1312
return {
1413
'content-type' : 'application/json; charset=utf-8',
1514
'X-Moesif-Application-Id' : _configuration.ApplicationId,
16-
'User-Agent': 'moesifapi-nodejs/' + pjson.version
15+
'User-Agent': _configuration.UserAgent
1716
};
1817
}
1918

lib/Controllers/HealthController.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
var _request = require('../Http/Client/RequestClient'),
88
_configuration = require('../configuration'),
9-
_APIHelper = require('../APIHelper'),
10-
pjson = require('../../package.json')
9+
_APIHelper = require('../APIHelper')
1110

1211
var HealthController = {
1312

@@ -31,7 +30,7 @@ var HealthController = {
3130
var _headers = {
3231
"accept" : "application/json",
3332
"X-Moesif-Application-Id" : _configuration.ApplicationId,
34-
"User-Agent": "moesifapi-nodejs/" + pjson.version
33+
"User-Agent": _configuration.UserAgent
3534
};
3635

3736
//Construct the request

lib/configuration.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
*
44
*
55
*/
6+
pjson = require('../package.json');
67

78
var configuration = {
89
//The base Uri for API calls
910
BaseUri : "https://api.moesif.net",
1011

1112
//Your Application Id for authentication/authorization
12-
ApplicationId : "SET_ME"
13+
ApplicationId : "SET_ME",
14+
UserAgent : 'moesifapi-nodejs/' + pjson.version
1315

1416
};
1517

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "moesifapi",
3-
"version": "2.0.8",
3+
"version": "2.0.9",
44
"description": "Collection/Data Ingestion API for Moesif",
55
"main": "./lib/index.js",
66
"keywords": [

0 commit comments

Comments
 (0)