File tree 2 files changed +12
-15
lines changed 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -156,13 +156,9 @@ module.exports.parseRequest = function parseRequest(req, kwargs) {
156
156
headers : headers ,
157
157
cookies : cookies ,
158
158
data : data ,
159
- url : url ,
160
- env : process . env
159
+ url : url
161
160
} ;
162
161
163
- // add remote ip
164
- http . env . REMOTE_ADDR = ip ;
165
-
166
162
// expose http interface
167
163
kwargs . request = http ;
168
164
@@ -171,12 +167,14 @@ module.exports.parseRequest = function parseRequest(req, kwargs) {
171
167
// typically found on req.user according to Express and Passport
172
168
173
169
var user = { } ;
174
- if ( req . user && ! kwargs . user ) {
175
- // shallow copy is okay because we are only modifying top-level
176
- // object (req.user)
177
- for ( var key in req . user ) {
178
- if ( { } . hasOwnProperty . call ( req . user , key ) ) {
179
- user [ key ] = req . user [ key ] ;
170
+ if ( ! kwargs . user ) {
171
+ if ( req . user ) {
172
+ // shallow copy is okay because we are only modifying top-level
173
+ // object (req.user)
174
+ for ( var key in req . user ) {
175
+ if ( { } . hasOwnProperty . call ( req . user , key ) ) {
176
+ user [ key ] = req . user [ key ] ;
177
+ }
180
178
}
181
179
}
182
180
Original file line number Diff line number Diff line change @@ -53,8 +53,7 @@ describe('raven.parsers', function() {
53
53
var parsed = raven . parsers . parseRequest ( mockReq ) ;
54
54
parsed . should . have . property ( 'request' ) ;
55
55
parsed . request . url . should . equal ( 'https://mattrobenolt.com/some/path?key=value' ) ;
56
- parsed . request . env . NODE_ENV . should . equal ( process . env . NODE_ENV ) ;
57
- parsed . request . env . REMOTE_ADDR . should . equal ( '127.0.0.1' ) ;
56
+ parsed . user . ip_address . should . equal ( '127.0.0.1' ) ;
58
57
} ) ;
59
58
60
59
describe ( '`headers` detection' , function ( ) {
@@ -308,7 +307,7 @@ describe('raven.parsers', function() {
308
307
309
308
var parsed = raven . parsers . parseRequest ( mockReq ) ;
310
309
311
- parsed . request . env . REMOTE_ADDR . should . equal ( '127.0.0.1' ) ;
310
+ parsed . user . ip_address . should . equal ( '127.0.0.1' ) ;
312
311
} ) ;
313
312
314
313
it ( 'should detect ip via `req.connection.remoteAddress`' , function ( ) {
@@ -325,7 +324,7 @@ describe('raven.parsers', function() {
325
324
326
325
var parsed = raven . parsers . parseRequest ( mockReq ) ;
327
326
328
- parsed . request . env . REMOTE_ADDR . should . equal ( '127.0.0.1' ) ;
327
+ parsed . user . ip_address . should . equal ( '127.0.0.1' ) ;
329
328
} ) ;
330
329
} ) ;
331
330
You can’t perform that action at this time.
0 commit comments