Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit 13f5038

Browse files
committed
ref: Delete empty properties before sending event to the server
1 parent 284d766 commit 13f5038

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

docs/config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Those configuration options are documented below:
3535

3636
.. describe:: logger
3737

38-
The name of the logger used by Sentry. Default: ``''``
38+
The name of the logger used by Sentry.
3939

4040
.. code-block:: javascript
4141

lib/client.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ extend(Raven.prototype, {
5454
this.root = options.root || global.process.cwd();
5555
this.transport = options.transport || transports[this.dsn.protocol];
5656
this.sendTimeout = options.sendTimeout || 1;
57-
this.release = options.release || global.process.env.SENTRY_RELEASE || '';
57+
this.release = options.release || global.process.env.SENTRY_RELEASE;
5858
this.environment =
5959
options.environment ||
6060
global.process.env.SENTRY_ENVIRONMENT ||
61-
global.process.env.NODE_ENV ||
62-
'';
61+
global.process.env.NODE_ENV;
6362

6463
// autoBreadcrumbs: true enables all, autoBreadcrumbs: false disables all
6564
// autoBreadcrumbs: { http: true } enables a single type
@@ -68,7 +67,7 @@ extend(Raven.prototype, {
6867
this.maxBreadcrumbs = Math.max(0, Math.min(options.maxBreadcrumbs || 30, 100));
6968

7069
this.captureUnhandledRejections = options.captureUnhandledRejections;
71-
this.loggerName = options.logger || '';
70+
this.loggerName = options.logger;
7271
this.dataCallback = options.dataCallback;
7372
this.shouldSendCallback = options.shouldSendCallback;
7473
this.sampleRate = typeof options.sampleRate === 'undefined' ? 1 : options.sampleRate;
@@ -266,11 +265,14 @@ extend(Raven.prototype, {
266265
kwargs.timestamp = new Date().toISOString().split('.')[0];
267266
kwargs.project = this.dsn.project_id;
268267
kwargs.platform = 'node';
268+
kwargs.release = this.release;
269269

270-
// Only include release information if it is set
271-
if (this.release) {
272-
kwargs.release = this.release;
273-
}
270+
// Cleanup empty properties before sending them to the server
271+
Object.keys(kwargs).forEach(function(key) {
272+
if (typeof kwargs[key] === 'undefined' || kwargs[key] === '') {
273+
delete kwargs[key];
274+
}
275+
});
274276

275277
if (this.dataCallback) {
276278
kwargs = this.dataCallback(kwargs);

0 commit comments

Comments
 (0)