Comparing version 1.4.0 to 1.5.0
Changelog | ||
========= | ||
1.5.0 | ||
----- | ||
- Allow use of a proxy when communicating with bugsnag | ||
1.4.0 | ||
@@ -5,0 +9,0 @@ ----- |
@@ -26,2 +26,4 @@ var Configuration, Logger, Utils, path; | ||
Configuration.proxy = null; | ||
Configuration.notifyHost = "notify.bugsnag.com"; | ||
@@ -77,2 +79,3 @@ | ||
Configuration.hostname = options.hostname || Configuration.hostname; | ||
Configuration.proxy = options.proxy; | ||
if (options.projectRoot != null) { | ||
@@ -79,0 +82,0 @@ Configuration.projectRoot = Utils.fullPath(options.projectRoot); |
@@ -1,2 +0,2 @@ | ||
var Configuration, Logger, Notification, Utils, path, requestInfo, | ||
var Configuration, Logger, Notification, Utils, path, request, requestInfo, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
@@ -14,2 +14,4 @@ | ||
request = require("request"); | ||
module.exports = Notification = (function() { | ||
@@ -95,3 +97,3 @@ var NOTIFIER_NAME, NOTIFIER_URL, NOTIFIER_VERSION, SUPPORTED_SEVERITIES; | ||
Notification.prototype.deliver = function(cb) { | ||
var cache, lib, options, payload, port, req; | ||
var cache, notifyUrl, options, payload, port; | ||
if (Utils.typeOf(cb) !== "function") { | ||
@@ -113,7 +115,6 @@ cb = null; | ||
}); | ||
notifyUrl = "" + (Configuration.useSSL ? "https" : "http") + "://" + Configuration.notifyHost + ":" + port + Configuration.notifyPath; | ||
options = { | ||
host: Configuration.notifyHost, | ||
port: port, | ||
path: Configuration.notifyPath, | ||
method: 'POST', | ||
proxy: Configuration.proxy, | ||
body: payload, | ||
headers: { | ||
@@ -125,30 +126,19 @@ "Content-Type": 'application/json', | ||
Configuration.logger.info(payload); | ||
lib = Configuration.useSSL ? require("https") : require("http"); | ||
req = lib.request(options, function(res) { | ||
var bodyRes; | ||
if (cb) { | ||
bodyRes = ""; | ||
res.setEncoding('utf8'); | ||
return res.on('data', function(chunk) { | ||
if (chunk) { | ||
return bodyRes += chunk; | ||
} | ||
}).on('end', function() { | ||
return request.post(notifyUrl, options, function(err, res, body) { | ||
if (err) { | ||
if (cb) { | ||
return cb(err); | ||
} else { | ||
return Configuration.logger.error(err); | ||
} | ||
} else { | ||
if (cb) { | ||
if (res.statusCode === 200) { | ||
return cb(null, bodyRes); | ||
return cb(null, body); | ||
} else { | ||
return cb(new Error(bodyRes)); | ||
return cb(new Error(body)); | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
req.on("error", function(err) { | ||
if (cb) { | ||
return cb(err); | ||
} else { | ||
return Configuration.logger.error(err); | ||
} | ||
}); | ||
req.write(payload, "utf-8"); | ||
return req.end(); | ||
}; | ||
@@ -155,0 +145,0 @@ |
@@ -17,9 +17,9 @@ var requestInfo; | ||
}; | ||
if (req.params && Object.keys(req.params).length > 0) { | ||
if (req.params && typeof req.params === 'object' && Object.keys(req.params).length > 0) { | ||
request.params = req.params; | ||
} | ||
if (req.query && Object.keys(req.query).length > 0) { | ||
if (req.query && typeof req.params === 'object' && Object.keys(req.query).length > 0) { | ||
request.query = req.query; | ||
} | ||
if (req.body && Object.keys(req.body).length > 0) { | ||
if (req.body && typeof req.params === 'object' && Object.keys(req.body).length > 0) { | ||
request.body = req.body; | ||
@@ -26,0 +26,0 @@ } |
{ | ||
"name": "bugsnag", | ||
"description": "Bugsnag notifier for node.js scripts", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"main": "./lib/bugsnag.js", | ||
"homepage": "http://bugsnag.com", | ||
"dependencies": { | ||
"stack-trace": ">=0.0.6" | ||
"stack-trace": ">=0.0.6", | ||
"request": ">=2.36.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.8.0", | ||
"mocha": "latest", | ||
"chai": "~1.5.0", | ||
@@ -16,5 +17,5 @@ "coffee-script": "latest", | ||
"grunt": "~0.4.0", | ||
"grunt-contrib-coffee": "~0.4.0", | ||
"grunt-contrib-coffee": "latest", | ||
"grunt-mocha-test": "latest", | ||
"grunt-bumpx": "~0.1.0", | ||
"grunt-bumpx": "latest", | ||
"express": "~3.4.2" | ||
@@ -21,0 +22,0 @@ }, |
@@ -224,3 +224,3 @@ Bugsnag Notifier for Node.js | ||
```javascript | ||
bugsnag.register("your-api-key-here", { onUncaughtError: function(error){ | ||
bugsnag.register("your-api-key-here", { onUncaughtError: function(err){ | ||
console.error(err.stack || err); | ||
@@ -248,2 +248,21 @@ }}); | ||
### proxy | ||
You can use a proxy server by configuring a proxy url when registering with bugsnag. | ||
```javascript | ||
bugsnag.register("your-api-key-here", { proxy: "http://localhost:8080" }); | ||
``` | ||
### filters | ||
You can prevent some meta-data keys (such as passwords) from being sent to Bugsnag by listing | ||
them in the filters. This is most useful if you're sending request data and don't want to | ||
accidentally log a user's password. The keys are matched with substring matching, so the default | ||
value of `["password"]` also excludes things like `"password_confirmation"`. | ||
```javascript | ||
bugsnag.register("your-api-key-here", { filters: ["password", "creditcard"] } | ||
``` | ||
Notify | ||
@@ -250,0 +269,0 @@ ------ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
77244
388
0
2
595
+ Addedrequest@>=2.36.0
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpsl@1.13.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)