Comparing version 0.10.0 to 0.10.1
@@ -0,1 +1,5 @@ | ||
0.10.1 / 2018-12-03 | ||
================== | ||
* support configurable API path (thanks CameronDiver) | ||
0.9.2 / 2018-05-22 | ||
@@ -2,0 +6,0 @@ ================== |
@@ -47,3 +47,4 @@ /* | ||
host: 'api.mixpanel.com', | ||
protocol: 'https' | ||
protocol: 'https', | ||
path: '', | ||
}; | ||
@@ -114,3 +115,3 @@ | ||
request_options.path = endpoint + "?" + querystring.stringify(query_params); | ||
request_options.path = metrics.config.path + endpoint + "?" + querystring.stringify(query_params); | ||
@@ -117,0 +118,0 @@ request = request_lib.request(request_options, function(res) { |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"homepage": "https://github.com/mixpanel/mixpanel-node", | ||
@@ -31,3 +31,3 @@ "author": "Carl Sverre", | ||
"devDependencies": { | ||
"nodeunit": "^0.9.1", | ||
"nodeunit": "^0.11.3", | ||
"proxyquire": "^1.7.11", | ||
@@ -34,0 +34,0 @@ "sinon": "^7.1.1" |
@@ -240,2 +240,3 @@ Mixpanel-node | ||
- [Marko Klopets](https://github.com/mklopets) | ||
- [Cameron Diver](https://github.com/CameronDiver) | ||
@@ -242,0 +243,0 @@ License |
@@ -15,3 +15,4 @@ var Mixpanel = require('../lib/mixpanel-node'); | ||
host: 'api.mixpanel.com', | ||
protocol: 'https' | ||
protocol: 'https', | ||
path: '' | ||
}, "default config is incorrect"); | ||
@@ -18,0 +19,0 @@ test.done(); |
@@ -172,2 +172,38 @@ var Mixpanel, | ||
"uses correct path": function(test) { | ||
var host = 'testhost.fakedomain'; | ||
var customPath = '/mypath'; | ||
var customHostnameMixpanel = Mixpanel.init('token', { | ||
host, | ||
path: customPath, | ||
}); | ||
var expected_http_request = { | ||
host, | ||
path: '/mypath?ip=0&verbose=0&data=e30%3D', | ||
}; | ||
customHostnameMixpanel.send_request({endpoint: "", data: {}}); | ||
test.ok(https.request.calledWithMatch(expected_http_request), "send_request didn't call https.request with correct hostname and port"); | ||
test.done(); | ||
}, | ||
"combines custom path and endpoint": function(test) { | ||
var host = 'testhost.fakedomain'; | ||
var customPath = '/mypath'; | ||
var customHostnameMixpanel = Mixpanel.init('token', { | ||
host, | ||
path: customPath, | ||
}); | ||
var expected_http_request = { | ||
host, | ||
path: '/mypath/track?ip=0&verbose=0&data=e30%3D', | ||
}; | ||
customHostnameMixpanel.send_request({endpoint: '/track', data: {}}); | ||
test.ok(https.request.calledWithMatch(expected_http_request), "send_request didn't call https.request with correct hostname and port"); | ||
test.done(); | ||
}, | ||
"uses HTTP_PROXY if set": function(test) { | ||
@@ -174,0 +210,0 @@ HttpsProxyAgent.reset(); // Mixpanel is instantiated in setup, need to reset callcount |
117904
2486
247