Comparing version 0.4.1 to 0.5.0
@@ -0,1 +1,5 @@ | ||
0.5.0 / 2016-09-15 | ||
=================== | ||
* optional https support (thanks chiangf) | ||
0.4.1 / 2016-09-09 | ||
@@ -2,0 +6,0 @@ =================== |
@@ -10,7 +10,13 @@ /* | ||
var http = require('http'), | ||
querystring = require('querystring'), | ||
Buffer = require('buffer').Buffer, | ||
util = require('util'); | ||
var http = require('http'), | ||
https = require('https'), | ||
querystring = require('querystring'), | ||
Buffer = require('buffer').Buffer, | ||
util = require('util'); | ||
var REQUEST_LIBS = { | ||
http: http, | ||
https: https | ||
}; | ||
var create_client = function(token, config) { | ||
@@ -28,3 +34,4 @@ var metrics = {}; | ||
verbose: false, | ||
host: 'api.mixpanel.com' | ||
host: 'api.mixpanel.com', | ||
protocol: 'http' | ||
}; | ||
@@ -52,2 +59,10 @@ | ||
var request_lib = REQUEST_LIBS[metrics.config.protocol]; | ||
if (!request_lib) { | ||
throw new Error( | ||
"Mixpanel Initialization Error: Unsupported protocol " + metrics.config.protocol + ". " + | ||
"Supported protocols are: " + Object.keys(REQUEST_LIBS) | ||
); | ||
} | ||
if (endpoint === '/import') { | ||
@@ -73,3 +88,3 @@ var key = metrics.config.key; | ||
http.get(request_options, function(res) { | ||
request_lib.get(request_options, function(res) { | ||
var data = ""; | ||
@@ -76,0 +91,0 @@ res.on('data', function(chunk) { |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"homepage": "https://github.com/mixpanel/mixpanel-node", | ||
@@ -13,0 +13,0 @@ "author": "Carl Sverre", |
@@ -23,2 +23,7 @@ Mixpanel-node | ||
// initialize mixpanel client configured to communicate over https | ||
var mixpanel = Mixpanel.init('6fd9434dba686db2d1ab66b4462a3a67', { | ||
protocol: 'https' | ||
}); | ||
// track an event with optional properties | ||
@@ -190,2 +195,3 @@ mixpanel.track('my event', { | ||
- [Jim Thomas](https://github.com/Left47) | ||
- [Frank Chiang](https://github.com/chiangf) | ||
@@ -192,0 +198,0 @@ License |
@@ -10,5 +10,9 @@ var Mixpanel = require('../lib/mixpanel-node'); | ||
"is set to correct defaults": function(test) { | ||
test.deepEqual(this.mixpanel.config, | ||
{ test: false, debug: false, verbose: false, host: 'api.mixpanel.com' }, | ||
"default config is incorrect"); | ||
test.deepEqual(this.mixpanel.config, { | ||
test: false, | ||
debug: false, | ||
verbose: false, | ||
host: 'api.mixpanel.com', | ||
protocol: 'http' | ||
}, "default config is incorrect"); | ||
test.done(); | ||
@@ -15,0 +19,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
80808
1743
201