File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -688,13 +688,18 @@ function now() {
688
688
}
689
689
690
690
function getHttpData ( ) {
691
+ if ( ! document . location || ! document . location . href ) {
692
+ return ;
693
+ }
694
+
691
695
var http = {
692
- url : document . location . href ,
693
696
headers : {
694
697
'User-Agent' : navigator . userAgent
695
698
}
696
699
} ;
697
700
701
+ http . url = document . location . href ;
702
+
698
703
if ( document . referrer ) {
699
704
http . headers . Referer = document . referrer ;
700
705
}
@@ -705,13 +710,18 @@ function getHttpData() {
705
710
function send ( data ) {
706
711
if ( ! isSetup ( ) ) return ;
707
712
708
- data = objectMerge ( {
713
+ var baseData = {
709
714
project : globalProject ,
710
715
logger : globalOptions . logger ,
711
716
platform : 'javascript' ,
712
717
// sentry.interfaces.Http
713
- request : getHttpData ( )
714
- } , data ) ;
718
+ } ;
719
+ var http = getHttpData ( ) ;
720
+ if ( http ) {
721
+ baseData . http = http ;
722
+ }
723
+
724
+ data = objectMerge ( baseData , data ) ;
715
725
716
726
// Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
717
727
data . tags = objectMerge ( objectMerge ( { } , globalOptions . tags ) , data . tags ) ;
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ describe('globals', function() {
196
196
var data = getHttpData ( ) ;
197
197
198
198
it ( 'should have a url' , function ( ) {
199
- assert . equal ( data . url , window . location . href ) ;
199
+ assert . equal ( data . url , window . location . href ) ;
200
200
} ) ;
201
201
202
202
it ( 'should have the user-agent header' , function ( ) {
@@ -211,7 +211,6 @@ describe('globals', function() {
211
211
assert . isUndefined ( data . headers . Referer ) ;
212
212
}
213
213
} ) ;
214
-
215
214
} ) ;
216
215
217
216
describe ( 'isUndefined' , function ( ) {
You can’t perform that action at this time.
0 commit comments