Skip to content

Commit

Permalink
fix: Always pass request throught parseRequest for raven-node (#1404)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek authored Jun 20, 2018
1 parent dc96502 commit 69bfcf6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/raven-node/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,22 +248,27 @@ extend(Raven.prototype, {
so we only parse a `req` property if the `request` property is absent/empty (and hence we won't clobber)
parseUser returns a partial kwargs object with a `request` property and possibly a `user` property
*/
kwargs.request = this._createRequestObject(
var request = this._createRequestObject(
globalContext.request,
domainContext.request,
kwargs.request
);
if (Object.keys(kwargs.request).length === 0) {
var req = this._createRequestObject(
delete kwargs.request;

if (Object.keys(request).length === 0) {
request = this._createRequestObject(
globalContext.req,
domainContext.req,
kwargs.req
);
if (Object.keys(req).length > 0) {
var parseUser = Object.keys(kwargs.user).length === 0 ? this.parseUser : false;
extend(kwargs, parsers.parseRequest(req, parseUser));
delete kwargs.req;
}
delete kwargs.req;
}

if (Object.keys(request).length > 0) {
var parseUser = Object.keys(kwargs.user).length === 0 ? this.parseUser : false;
extend(kwargs, parsers.parseRequest(request, parseUser));
} else {
kwargs.request = {};
}

kwargs.modules = utils.getModules();
Expand Down

0 comments on commit 69bfcf6

Please sign in to comment.