Skip to content

Commit 455e357

Browse files
committed
Dont return http data without url
1 parent e78d54f commit 455e357

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/raven.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -679,15 +679,17 @@ function now() {
679679
}
680680

681681
function getHttpData() {
682+
if (!document.location || !document.location.href) {
683+
return;
684+
}
685+
682686
var http = {
683687
headers: {
684688
'User-Agent': navigator.userAgent
685689
}
686690
};
687691

688-
if (document.location && document.location.href) {
689-
http.url = document.location.href;
690-
}
692+
http.url = document.location.href;
691693

692694
if (document.referrer) {
693695
http.headers.Referer = document.referrer;
@@ -699,13 +701,18 @@ function getHttpData() {
699701
function send(data) {
700702
if (!isSetup()) return;
701703

702-
data = objectMerge({
704+
var baseData = {
703705
project: globalProject,
704706
logger: globalOptions.logger,
705707
platform: 'javascript',
706708
// sentry.interfaces.Http
707-
request: getHttpData()
708-
}, data);
709+
};
710+
var http = getHttpData();
711+
if (http) {
712+
baseData.http = http;
713+
}
714+
715+
data = objectMerge(baseData, data);
709716

710717
// Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
711718
data.tags = objectMerge(objectMerge({}, globalOptions.tags), data.tags);

0 commit comments

Comments
 (0)