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() {
688688}
689689
690690function getHttpData ( ) {
691+ if ( ! document . location || ! document . location . href ) {
692+ return ;
693+ }
694+
691695 var http = {
692- url : document . location . href ,
693696 headers : {
694697 'User-Agent' : navigator . userAgent
695698 }
696699 } ;
697700
701+ http . url = document . location . href ;
702+
698703 if ( document . referrer ) {
699704 http . headers . Referer = document . referrer ;
700705 }
@@ -705,13 +710,18 @@ function getHttpData() {
705710function send ( data ) {
706711 if ( ! isSetup ( ) ) return ;
707712
708- data = objectMerge ( {
713+ var baseData = {
709714 project : globalProject ,
710715 logger : globalOptions . logger ,
711716 platform : 'javascript' ,
712717 // 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 ) ;
715725
716726 // Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
717727 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() {
196196 var data = getHttpData ( ) ;
197197
198198 it ( 'should have a url' , function ( ) {
199- assert . equal ( data . url , window . location . href ) ;
199+ assert . equal ( data . url , window . location . href ) ;
200200 } ) ;
201201
202202 it ( 'should have the user-agent header' , function ( ) {
@@ -211,7 +211,6 @@ describe('globals', function() {
211211 assert . isUndefined ( data . headers . Referer ) ;
212212 }
213213 } ) ;
214-
215214 } ) ;
216215
217216 describe ( 'isUndefined' , function ( ) {
You can’t perform that action at this time.
0 commit comments