File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,20 @@ Optional settings
45
45
release: ' 721e41770371db95eee98ca2707686226b993eda'
46
46
}
47
47
48
- Can also be defined with ``Raven.setReleaseContext('721e41770371db95eee98ca2707686226b993eda') ``.
48
+ Can also be defined with ``Raven.setRelease('721e41770371db95eee98ca2707686226b993eda') ``.
49
+
50
+ .. describe :: serverName
51
+
52
+ Typically this would be the server name, but that doesn’t exist on
53
+ all platforms. Instead you may use something like the device ID, as it
54
+ indicates the host which the client is running on.
55
+
56
+ .. code-block :: javascript
57
+
58
+ {
59
+ serverName: device .uuid
60
+ }
61
+
49
62
50
63
.. describe :: tags
51
64
Original file line number Diff line number Diff line change @@ -787,6 +787,8 @@ function send(data) {
787
787
788
788
// Include the release if it's defined in globalOptions
789
789
if ( globalOptions . release ) data . release = globalOptions . release ;
790
+ // Include server_name if it's defined in globalOptions
791
+ if ( globalOptions . serverName ) data . server_name = globalOptions . serverName ;
790
792
791
793
if ( isFunction ( globalOptions . dataCallback ) ) {
792
794
data = globalOptions . dataCallback ( data ) || data ;
Original file line number Diff line number Diff line change @@ -1176,6 +1176,38 @@ describe('globals', function() {
1176
1176
} ) ;
1177
1177
} ) ;
1178
1178
1179
+ it ( 'should attach server_name if available' , function ( ) {
1180
+ this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
1181
+ this . sinon . stub ( window , 'makeRequest' ) ;
1182
+ this . sinon . stub ( window , 'getHttpData' ) . returns ( {
1183
+ url : 'http://localhost/?a=b' ,
1184
+ headers : { 'User-Agent' : 'lolbrowser' }
1185
+ } ) ;
1186
+
1187
+ globalOptions = {
1188
+ projectId : 2 ,
1189
+ logger : 'javascript' ,
1190
+ serverName : 'abc123' ,
1191
+ } ;
1192
+
1193
+ send ( { foo : 'bar' } ) ;
1194
+ assert . deepEqual ( window . makeRequest . lastCall . args [ 0 ] . data , {
1195
+ project : '2' ,
1196
+ server_name : 'abc123' ,
1197
+ logger : 'javascript' ,
1198
+ platform : 'javascript' ,
1199
+ request : {
1200
+ url : 'http://localhost/?a=b' ,
1201
+ headers : {
1202
+ 'User-Agent' : 'lolbrowser'
1203
+ }
1204
+ } ,
1205
+ event_id : 'abc123' ,
1206
+ foo : 'bar' ,
1207
+ extra : { 'session:duration' : 100 }
1208
+ } ) ;
1209
+ } ) ;
1210
+
1179
1211
it ( 'should pass correct opts to makeRequest' , function ( ) {
1180
1212
this . sinon . stub ( window , 'isSetup' ) . returns ( true ) ;
1181
1213
this . sinon . stub ( window , 'makeRequest' ) ;
You can’t perform that action at this time.
0 commit comments