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

Commit ea4ad9f

Browse files
committed
Add test to verify req isn't appended to payload
1 parent 336b79b commit ea4ad9f

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

test/raven.client.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,35 @@ describe('raven.Client', function () {
266266
kwargs.extra.foo = kwargs;
267267
client.captureException(new Error('wtf?'), kwargs);
268268
});
269+
270+
it('shouldn\'t attach `req` kwargs to the outbound payload', function (done) {
271+
var scope = nock('https://app.getsentry.com:8443')
272+
.filteringRequestBody(/.*/, '*')
273+
.post('/api/269/store/', '*')
274+
.reply(200, function (uri, body) {
275+
zlib.inflate(new Buffer(body, 'base64'), function (err, dec) {
276+
if (err) return done(err);
277+
var msg = JSON.parse(dec.toString());
278+
279+
msg.should.not.have.property('req');
280+
msg.should.have.property('request');
281+
done();
282+
});
283+
return 'OK';
284+
});
285+
286+
var dsn = 'https://public:private@app.getsentry.com:8443/269';
287+
var client = new raven.Client(dsn);
288+
client.on('logged', function () {
289+
scope.done();
290+
});
291+
client.captureException(new Error('wtf?'), {
292+
req: {
293+
method: 'GET',
294+
originalUrl: 'http://example.com/'
295+
}
296+
});
297+
});
269298
});
270299

271300
describe('#install()', function () {

0 commit comments

Comments
 (0)