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) {
740
740
741
741
if ( ! isSetup ( ) ) return ;
742
742
743
- makeRequest ( {
743
+ ( globalOptions . transport || makeRequest ) ( {
744
744
url : globalServer ,
745
745
auth : {
746
746
sentry_version : '4' ,
Original file line number Diff line number Diff line change @@ -1157,6 +1157,36 @@ describe('globals', function() {
1157
1157
assert . isFunction ( opts . onError ) ;
1158
1158
} ) ;
1159
1159
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
+
1160
1190
it ( 'should check `isSetup`' , function ( ) {
1161
1191
this . sinon . stub ( window , 'isSetup' ) . returns ( false ) ;
1162
1192
this . sinon . stub ( window , 'makeRequest' ) ;
You can’t perform that action at this time.
0 commit comments