Skip to content

Commit 5f1dc58

Browse files
committed
Merge branch 'location'
2 parents 675f74d + 455e357 commit 5f1dc58

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/raven.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,13 +688,18 @@ function now() {
688688
}
689689

690690
function 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() {
705710
function 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);

test/raven.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff 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() {

0 commit comments

Comments
 (0)