Skip to content

Commit 6da2d10

Browse files
authored
Update dependencies (#16)
* update config manager in case the responsebody is already parsed json * add responseBody * fix changes * bump version * only need to bump minor version
1 parent 9cbcaed commit 6da2d10

File tree

3 files changed

+69
-323
lines changed

3 files changed

+69
-323
lines changed

lib/moesifConfigManager.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,18 @@ MoesifConfigManager.prototype.tryGetConfig = function () {
3838

3939
var that = this;
4040

41-
moesifController.getAppConfig(function (_, __, event) {
41+
moesifController.getAppConfig(function (err, __, event) {
4242
that._loadingConfig = false;
4343

44-
if (event && event.response.statusCode === 200) {
44+
if (event && event.response && event.response.statusCode === 200) {
4545
that._configHash = event.response.headers[HASH_HEADER];
46+
var responseBody = event.response.body;
4647
try {
47-
that._config = JSON.parse(event.response.body);
48+
if (typeof responseBody === 'string') {
49+
that._config = JSON.parse(responseBody);
50+
} else {
51+
that._config = responseBody;
52+
}
4853
that._lastConfigUpdate = now();
4954
} catch (e) {
5055
console.warn('moesif: error parsing config');

0 commit comments

Comments
 (0)