1
1
var assert = require ( 'assert' ) ;
2
2
var raven = require ( '../' ) ;
3
- var client = new raven . Client ( )
3
+ var client = new raven . Client ( ) ;
4
+
4
5
raven . parsers = require ( '../lib/parsers' ) ;
5
6
6
7
describe ( 'raven.parsers' , function ( ) {
@@ -176,22 +177,6 @@ describe('raven.parsers', function(){
176
177
} ) ;
177
178
178
179
describe ( '`cookie` detection' , function ( ) {
179
- it ( 'should parse `req.cookies`' , function ( ) {
180
- var mockReq = {
181
- method : 'GET' ,
182
- url : '/some/path?key=value' ,
183
- headers : {
184
- host : 'mattrobenolt.com' ,
185
- } ,
186
- cookies : {
187
- foo : 'bar'
188
- }
189
- } ;
190
-
191
- var parsed = raven . parsers . parseRequest ( mockReq ) ;
192
- parsed [ 'sentry.interfaces.Http' ] . cookies . should . eql ( { foo : 'bar' } ) ;
193
- } ) ;
194
-
195
180
it ( 'should parse `req.headers.cookie`' , function ( ) {
196
181
var mockReq = {
197
182
method : 'GET' ,
@@ -206,59 +191,20 @@ describe('raven.parsers', function(){
206
191
parsed [ 'sentry.interfaces.Http' ] . cookies . should . eql ( { foo : 'bar' } ) ;
207
192
} ) ;
208
193
209
- it ( 'should parse `req.headers.cookies `' , function ( ) {
194
+ it ( 'should parse `req.header.cookie `' , function ( ) {
210
195
var mockReq = {
211
196
method : 'GET' ,
212
197
url : '/some/path?key=value' ,
213
- headers : {
214
- host : 'mattrobenolt.com' ,
215
- cookies : 'qux=foo'
216
- }
217
- } ;
218
-
219
- var parsed = raven . parsers . parseRequest ( mockReq ) ;
220
- parsed [ 'sentry.interfaces.Http' ] . cookies . should . eql ( { qux : 'foo' } ) ;
221
- } ) ;
222
-
223
- it ( 'should parse `req.cookies`' , function ( ) {
224
- var mockReq = {
225
- method : 'GET' ,
226
- url : '/some/path?key=value' ,
227
- headers : {
198
+ header : {
228
199
host : 'mattrobenolt.com' ,
229
- } ,
230
- cookies : {
231
- foo : 'bar'
200
+ cookie : 'foo=bar'
232
201
}
233
202
} ;
234
203
235
204
var parsed = raven . parsers . parseRequest ( mockReq ) ;
236
205
parsed [ 'sentry.interfaces.Http' ] . cookies . should . eql ( { foo : 'bar' } ) ;
237
206
} ) ;
238
207
239
- it ( 'should fallback to `req.headers.cookies` if `req.cookies` is not a plain object' , function ( ) {
240
- var cookie = function Cookie ( name , value ) {
241
- this . name = name ;
242
- this . value = value ;
243
- } ;
244
-
245
- var cookies = function Cookies ( ) {
246
- this . cookies = [ new Cookie ( 'foo' , 'bar' ) ] ;
247
- } ;
248
-
249
- var mockReq = {
250
- method : 'GET' ,
251
- url : '/some/path?key=value' ,
252
- headers : {
253
- host : 'mattrobenolt.com' ,
254
- cookie : 'qux=baz'
255
- } ,
256
- cookies : cookies
257
- } ;
258
-
259
- var parsed = raven . parsers . parseRequest ( mockReq ) ;
260
- parsed [ 'sentry.interfaces.Http' ] . cookies . should . eql ( { qux : 'baz' } ) ;
261
- } ) ;
262
208
} ) ;
263
209
264
210
describe ( '`query` detection' , function ( ) {
0 commit comments