universal-analytics
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -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 @@ |
{ | ||
"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 @@ |
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
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
113530
2112