Socket
Socket
Sign inDemoInstall

universal-analytics

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-analytics - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

5

lib/index.js

@@ -294,3 +294,6 @@

self._log(count++ + ": " + JSON.stringify(params));
request.post(path, fn);
var options = {
headers: self.options.headers || {}
};
request.post(path, options, fn);
}

@@ -297,0 +300,0 @@

2

package.json
{
"name": "universal-analytics",
"version": "0.2.2",
"version": "0.2.3",
"description": "A node module for Google's Universal Analytics tracking",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,3 +22,3 @@

beforeEach(function () {
post = sinon.stub(request, "post").callsArg(1);
post = sinon.stub(request, "post").callsArg(2);
});

@@ -72,4 +72,30 @@

visitor.send(fn);
})
});
it("should add custom headers to request header", function (done) {
var fn = sinon.spy(function () {
fn.calledOnce.should.equal(true, "callback should have been called once");
fn.thisValues[0].should.equal(visitor, "callback should be called in the context of the visitor instance");
post.calledOnce.should.equal(true, "request should have been POSTed");
var parsedUrl = url.parse(post.args[0][0]);
var options = post.args[0][1];
(parsedUrl.protocol + "//" + parsedUrl.host).should.equal(config.hostname);
options.should.have.keys(["headers"]);
options.headers.should.have.key("User-Agent");
options.headers["User-Agent"].should.equal("Test User Agent");
done();
});
var visitor = ua({
headers: {'User-Agent': 'Test User Agent'}
});
visitor._queue.push({});
visitor.send(fn);
});
})

@@ -76,0 +102,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc