Skip to content

Commit 433f6e8

Browse files
authored
Release 2.25.2 (#1047)
1 parent bf56f33 commit 433f6e8

27 files changed

+531
-95
lines changed

dist/rollbar.js

+127-18
Original file line numberDiff line numberDiff line change
@@ -1349,10 +1349,10 @@ module.exports = rollbar;
13491349
var Rollbar = __webpack_require__(8);
13501350
var telemeter = __webpack_require__(28);
13511351
var instrumenter = __webpack_require__(29);
1352-
var polyfillJSON = __webpack_require__(31);
1353-
var wrapGlobals = __webpack_require__(33);
1352+
var polyfillJSON = __webpack_require__(32);
1353+
var wrapGlobals = __webpack_require__(34);
13541354
var scrub = __webpack_require__(4);
1355-
var truncation = __webpack_require__(34);
1355+
var truncation = __webpack_require__(35);
13561356

13571357
Rollbar.setComponents({
13581358
telemeter: telemeter,
@@ -3587,20 +3587,25 @@ function addBaseInfo(item, options, callback) {
35873587

35883588
function addRequestInfo(window) {
35893589
return function(item, options, callback) {
3590-
if (!window || !window.location) {
3591-
return callback(null, item);
3590+
var requestInfo = {};
3591+
3592+
if (window && window.location) {
3593+
requestInfo.url = window.location.href;
3594+
requestInfo.query_string = window.location.search;
35923595
}
3596+
35933597
var remoteString = '$remote_ip';
35943598
if (!options.captureIp) {
35953599
remoteString = null;
35963600
} else if (options.captureIp !== true) {
35973601
remoteString += '_anonymize';
35983602
}
3599-
_.set(item, 'data.request', {
3600-
url: window.location.href,
3601-
query_string: window.location.search,
3602-
user_ip: remoteString
3603-
});
3603+
if (remoteString) requestInfo.user_ip = remoteString;
3604+
3605+
if (Object.keys(requestInfo).length > 0) {
3606+
_.set(item, 'data.request', requestInfo);
3607+
}
3608+
36043609
callback(null, item);
36053610
};
36063611
}
@@ -4584,7 +4589,7 @@ module.exports = {
45844589

45854590

45864591
module.exports = {
4587-
version: '2.25.1',
4592+
version: '2.25.2',
45884593
endpoint: 'api.rollbar.com/api/1/item/',
45894594
logLevel: 'debug',
45904595
reportLevel: 'debug',
@@ -4856,9 +4861,10 @@ module.exports = Telemeter;
48564861

48574862

48584863
var _ = __webpack_require__(0);
4864+
var headers = __webpack_require__(30);
48594865
var scrub = __webpack_require__(4);
48604866
var urlparser = __webpack_require__(2);
4861-
var domUtil = __webpack_require__(30);
4867+
var domUtil = __webpack_require__(31);
48624868

48634869
var defaults = {
48644870
network: true,
@@ -5219,7 +5225,7 @@ Instrumenter.prototype.instrumentNetwork = function() {
52195225
if (args[1] && args[1].headers) {
52205226
// Argument may be a Headers object, or plain object. Ensure here that
52215227
// we are working with a Headers object with case-insensitive keys.
5222-
var reqHeaders = new Headers(args[1].headers);
5228+
var reqHeaders = headers(args[1].headers);
52235229

52245230
metadata.request_content_type = reqHeaders.get('Content-Type');
52255231

@@ -5632,6 +5638,109 @@ module.exports = Instrumenter;
56325638
"use strict";
56335639

56345640

5641+
/*
5642+
* headers - Detect when fetch Headers are undefined and use a partial polyfill.
5643+
*
5644+
* A full polyfill is not used in order to keep package size as small as possible.
5645+
* Since this is only used internally and is not added to the window object,
5646+
* the full interface doesn't need to be supported.
5647+
*
5648+
* This implementation is modified from whatwg-fetch:
5649+
* https://github.com/github/fetch
5650+
*/
5651+
function headers(headers) {
5652+
if (typeof Headers === 'undefined') {
5653+
return new FetchHeaders(headers);
5654+
}
5655+
5656+
return new Headers(headers);
5657+
}
5658+
5659+
function normalizeName(name) {
5660+
if (typeof name !== 'string') {
5661+
name = String(name)
5662+
}
5663+
return name.toLowerCase()
5664+
}
5665+
5666+
function normalizeValue(value) {
5667+
if (typeof value !== 'string') {
5668+
value = String(value)
5669+
}
5670+
return value
5671+
}
5672+
5673+
function iteratorFor(items) {
5674+
var iterator = {
5675+
next: function() {
5676+
var value = items.shift()
5677+
return {done: value === undefined, value: value}
5678+
}
5679+
}
5680+
5681+
return iterator
5682+
}
5683+
5684+
function FetchHeaders(headers) {
5685+
this.map = {}
5686+
5687+
if (headers instanceof FetchHeaders) {
5688+
headers.forEach(function(value, name) {
5689+
this.append(name, value)
5690+
}, this)
5691+
} else if (Array.isArray(headers)) {
5692+
headers.forEach(function(header) {
5693+
this.append(header[0], header[1])
5694+
}, this)
5695+
} else if (headers) {
5696+
Object.getOwnPropertyNames(headers).forEach(function(name) {
5697+
this.append(name, headers[name])
5698+
}, this)
5699+
}
5700+
}
5701+
5702+
FetchHeaders.prototype.append = function(name, value) {
5703+
name = normalizeName(name)
5704+
value = normalizeValue(value)
5705+
var oldValue = this.map[name]
5706+
this.map[name] = oldValue ? oldValue + ', ' + value : value
5707+
}
5708+
5709+
FetchHeaders.prototype.get = function(name) {
5710+
name = normalizeName(name)
5711+
return this.has(name) ? this.map[name] : null
5712+
}
5713+
5714+
FetchHeaders.prototype.has = function(name) {
5715+
return this.map.hasOwnProperty(normalizeName(name))
5716+
}
5717+
5718+
FetchHeaders.prototype.forEach = function(callback, thisArg) {
5719+
for (var name in this.map) {
5720+
if (this.map.hasOwnProperty(name)) {
5721+
callback.call(thisArg, this.map[name], name, this)
5722+
}
5723+
}
5724+
}
5725+
5726+
FetchHeaders.prototype.entries = function() {
5727+
var items = []
5728+
this.forEach(function(value, name) {
5729+
items.push([name, value])
5730+
})
5731+
return iteratorFor(items)
5732+
}
5733+
5734+
module.exports = headers;
5735+
5736+
5737+
/***/ }),
5738+
/* 31 */
5739+
/***/ (function(module, exports, __webpack_require__) {
5740+
5741+
"use strict";
5742+
5743+
56355744
function getElementType(e) {
56365745
return (e.getAttribute('type') || '').toLowerCase();
56375746
}
@@ -5765,19 +5874,19 @@ module.exports = {
57655874

57665875

57675876
/***/ }),
5768-
/* 31 */
5877+
/* 32 */
57695878
/***/ (function(module, exports, __webpack_require__) {
57705879

57715880
"use strict";
57725881

57735882

5774-
var polyfillJSON = __webpack_require__(32);
5883+
var polyfillJSON = __webpack_require__(33);
57755884

57765885
module.exports = polyfillJSON;
57775886

57785887

57795888
/***/ }),
5780-
/* 32 */
5889+
/* 33 */
57815890
/***/ (function(module, exports) {
57825891

57835892
// json3.js
@@ -6546,7 +6655,7 @@ module.exports = setupCustomJSON;
65466655

65476656

65486657
/***/ }),
6549-
/* 33 */
6658+
/* 34 */
65506659
/***/ (function(module, exports, __webpack_require__) {
65516660

65526661
"use strict";
@@ -6596,7 +6705,7 @@ module.exports = wrapGlobals;
65966705

65976706

65986707
/***/ }),
6599-
/* 34 */
6708+
/* 35 */
66006709
/***/ (function(module, exports, __webpack_require__) {
66016710

66026711
"use strict";

dist/rollbar.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rollbar.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rollbar.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)