File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -952,6 +952,48 @@ describe('raven.Client', function () {
952952 } ) ;
953953 } ) ;
954954 } ) ;
955+
956+ it ( 'should parse a req property from context' , function ( done ) {
957+ var scope = nock ( 'https://app.getsentry.com' )
958+ . filteringRequestBody ( / .* / , '*' )
959+ . post ( '/api/269/store/' , '*' )
960+ . reply ( 200 , function ( uri , body ) {
961+ zlib . inflate ( new Buffer ( body , 'base64' ) , function ( err , dec ) {
962+ if ( err ) return done ( err ) ;
963+ var msg = JSON . parse ( dec . toString ( ) ) ;
964+
965+ msg . request . method . should . equal ( 'GET' ) ;
966+ msg . request . url . should . equal ( 'https://sentry.io/hello' ) ;
967+ msg . user . should . eql ( {
968+ username : 'lewis'
969+ } ) ;
970+
971+ done ( ) ;
972+ } ) ;
973+ return 'OK' ;
974+ } ) ;
975+
976+
977+ client . context ( function ( ) {
978+ client . setContext ( {
979+ req : {
980+ protocol : 'https' ,
981+ hostname : 'sentry.io' ,
982+ url : '/hello' ,
983+ method : 'GET' ,
984+ user : {
985+ username : 'lewis'
986+ }
987+ }
988+ } ) ;
989+
990+ setTimeout ( function ( ) {
991+ client . captureException ( new Error ( 'foo' ) , function ( ) {
992+ scope . done ( ) ;
993+ } ) ;
994+ } , 0 ) ;
995+ } ) ;
996+ } ) ;
955997 } ) ;
956998
957999 describe ( '#intercept()' , function ( ) {
You can’t perform that action at this time.
0 commit comments