File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -778,6 +778,8 @@ function send(data) {
778
778
779
779
// Include the release if it's defined in globalOptions
780
780
if ( globalOptions . release ) data . release = globalOptions . release ;
781
+ // Include server_name if it's defined in globalOptions
782
+ if ( globalOptions . serverName ) data . server_name = globalOptions . serverName ;
781
783
782
784
if ( isFunction ( globalOptions . dataCallback ) ) {
783
785
data = globalOptions . dataCallback ( data ) || data ;
Original file line number Diff line number Diff line change @@ -1153,6 +1153,38 @@ describe('globals', function() {
1153
1153
} ) ;
1154
1154
} ) ;
1155
1155
1156
+ it ( 'should attach server_name if available' , function ( ) {
1157
+ this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
1158
+ this . sinon . stub ( window , 'makeRequest' ) ;
1159
+ this . sinon . stub ( window , 'getHttpData' ) . returns ( {
1160
+ url : 'http://localhost/?a=b' ,
1161
+ headers : { 'User-Agent' : 'lolbrowser' }
1162
+ } ) ;
1163
+
1164
+ globalOptions = {
1165
+ projectId : 2 ,
1166
+ logger : 'javascript' ,
1167
+ serverName : 'abc123' ,
1168
+ } ;
1169
+
1170
+ send ( { foo : 'bar' } ) ;
1171
+ assert . deepEqual ( window . makeRequest . lastCall . args [ 0 ] . data , {
1172
+ project : '2' ,
1173
+ server_name : 'abc123' ,
1174
+ logger : 'javascript' ,
1175
+ platform : 'javascript' ,
1176
+ request : {
1177
+ url : 'http://localhost/?a=b' ,
1178
+ headers : {
1179
+ 'User-Agent' : 'lolbrowser'
1180
+ }
1181
+ } ,
1182
+ event_id : 'abc123' ,
1183
+ foo : 'bar' ,
1184
+ extra : { 'session:duration' : 100 }
1185
+ } ) ;
1186
+ } ) ;
1187
+
1156
1188
it ( 'should pass correct opts to makeRequest' , function ( ) {
1157
1189
this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
1158
1190
this . sinon . stub ( window , 'makeRequest' ) ;
You can’t perform that action at this time.
0 commit comments