File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -740,7 +740,7 @@ function send(data) {
740740
741741 if ( ! isSetup ( ) ) return ;
742742
743- makeRequest ( {
743+ ( globalOptions . transport || makeRequest ) ( {
744744 url : globalServer ,
745745 auth : {
746746 sentry_version : '4' ,
Original file line number Diff line number Diff line change @@ -1157,6 +1157,36 @@ describe('globals', function() {
11571157 assert . isFunction ( opts . onError ) ;
11581158 } ) ;
11591159
1160+ it ( 'should call globalOptions.transport if specified' , function ( ) {
1161+ this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
1162+ this . sinon . stub ( window , 'getHttpData' ) . returns ( {
1163+ url : 'http://localhost/?a=b' ,
1164+ headers : { 'User-Agent' : 'lolbrowser' }
1165+ } ) ;
1166+
1167+ globalProject = '2' ;
1168+ globalOptions = {
1169+ logger : 'javascript' ,
1170+ transport : sinon . stub ( )
1171+ } ;
1172+
1173+ send ( { foo : 'bar' } ) ;
1174+ assert . deepEqual ( globalOptions . transport . lastCall . args [ 0 ] . data , {
1175+ project : '2' ,
1176+ logger : 'javascript' ,
1177+ platform : 'javascript' ,
1178+ request : {
1179+ url : 'http://localhost/?a=b' ,
1180+ headers : {
1181+ 'User-Agent' : 'lolbrowser'
1182+ }
1183+ } ,
1184+ event_id : 'abc123' ,
1185+ foo : 'bar' ,
1186+ extra : { 'session:duration' : 100 }
1187+ } ) ;
1188+ } ) ;
1189+
11601190 it ( 'should check `isSetup`' , function ( ) {
11611191 this . sinon . stub ( window , 'isSetup' ) . returns ( false ) ;
11621192 this . sinon . stub ( window , 'makeRequest' ) ;
You can’t perform that action at this time.
0 commit comments