@bitmovin/api-sdk 1.168.0 → 1.170.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,7 +31,7 @@ If you have any questions regarding the SDK, provided examples or our services,
31
31
  ## Installation
32
32
 
33
33
  ``` bash
34
- npm install @bitmovin/api-sdk@1.168.0
34
+ npm install @bitmovin/api-sdk@1.170.0
35
35
  ```
36
36
 
37
37
  ## Initialization
@@ -5987,7 +5987,7 @@ var HeaderHandler = /** @class */ (function (_super) {
5987
5987
  var headers = {
5988
5988
  'X-Api-Key': apiKey,
5989
5989
  'X-Api-Client': 'bitmovin-api-sdk-javascript',
5990
- 'X-Api-Client-Version': '1.168.0',
5990
+ 'X-Api-Client-Version': '1.170.0',
5991
5991
  'Content-Type': 'application/json'
5992
5992
  };
5993
5993
  if (tenantOrgId) {
@@ -15792,6 +15792,7 @@ var __extends = (this && this.__extends) || (function () {
15792
15792
  Object.defineProperty(exports, "__esModule", ({ value: true }));
15793
15793
  var BaseAPI_1 = __webpack_require__(/*! ../../../../common/BaseAPI */ "./common/BaseAPI.ts");
15794
15794
  var Mapper_1 = __webpack_require__(/*! ../../../../common/Mapper */ "./common/Mapper.ts");
15795
+ var BitmovinResponse_1 = __webpack_require__(/*! ../../../../models/BitmovinResponse */ "./models/BitmovinResponse.ts");
15795
15796
  var StartLiveChannelEncodingRequest_1 = __webpack_require__(/*! ../../../../models/StartLiveChannelEncodingRequest */ "./models/StartLiveChannelEncodingRequest.ts");
15796
15797
  /**
15797
15798
  * HdApi - object-oriented interface
@@ -15818,6 +15819,21 @@ var HdApi = /** @class */ (function (_super) {
15818
15819
  return (0, Mapper_1.map)(response, StartLiveChannelEncodingRequest_1.default);
15819
15820
  });
15820
15821
  };
15822
+ /**
15823
+ * @summary Start HD Options Live Encoding
15824
+ * @param {string} encodingId Id of the encoding
15825
+ * @param {StartLiveChannelEncodingRequest} startLiveChannelEncodingRequest Live Encoding startup options
15826
+ * @throws {BitmovinError}
15827
+ * @memberof HdApi
15828
+ */
15829
+ HdApi.prototype.start = function (encodingId, startLiveChannelEncodingRequest) {
15830
+ var pathParamMap = {
15831
+ encoding_id: encodingId
15832
+ };
15833
+ return this.restClient.post('/encoding/encodings/{encoding_id}/live/hd/start', pathParamMap, startLiveChannelEncodingRequest).then(function (response) {
15834
+ return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
15835
+ });
15836
+ };
15821
15837
  return HdApi;
15822
15838
  }(BaseAPI_1.BaseAPI));
15823
15839
  exports["default"] = HdApi;
@@ -55555,6 +55571,7 @@ var AnalyticsAttribute;
55555
55571
  AnalyticsAttribute["VIDEOTIME_START"] = "VIDEOTIME_START";
55556
55572
  AnalyticsAttribute["VIDEOSTART_FAILED"] = "VIDEOSTART_FAILED";
55557
55573
  AnalyticsAttribute["VIDEOSTART_FAILED_REASON"] = "VIDEOSTART_FAILED_REASON";
55574
+ AnalyticsAttribute["VIEWTIME"] = "VIEWTIME";
55558
55575
  })(AnalyticsAttribute = exports.AnalyticsAttribute || (exports.AnalyticsAttribute = {}));
55559
55576
  exports["default"] = AnalyticsAttribute;
55560
55577
 
@@ -82496,6 +82513,40 @@ exports.StreamsLiveUpdateRequest = StreamsLiveUpdateRequest;
82496
82513
  exports["default"] = StreamsLiveUpdateRequest;
82497
82514
 
82498
82515
 
82516
+ /***/ }),
82517
+
82518
+ /***/ "./models/StreamsSearchResponse.ts":
82519
+ /*!*****************************************!*\
82520
+ !*** ./models/StreamsSearchResponse.ts ***!
82521
+ \*****************************************/
82522
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
82523
+
82524
+ "use strict";
82525
+
82526
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
82527
+ exports.StreamsSearchResponse = void 0;
82528
+ var Mapper_1 = __webpack_require__(/*! ../common/Mapper */ "./common/Mapper.ts");
82529
+ /**
82530
+ * @export
82531
+ * @class StreamsSearchResponse
82532
+ */
82533
+ var StreamsSearchResponse = /** @class */ (function () {
82534
+ function StreamsSearchResponse(obj) {
82535
+ if (!obj) {
82536
+ return;
82537
+ }
82538
+ this.id = (0, Mapper_1.map)(obj.id);
82539
+ this.title = (0, Mapper_1.map)(obj.title);
82540
+ this.description = (0, Mapper_1.map)(obj.description);
82541
+ this.createdAt = (0, Mapper_1.map)(obj.createdAt, Date);
82542
+ this.type = (0, Mapper_1.map)(obj.type);
82543
+ }
82544
+ return StreamsSearchResponse;
82545
+ }());
82546
+ exports.StreamsSearchResponse = StreamsSearchResponse;
82547
+ exports["default"] = StreamsSearchResponse;
82548
+
82549
+
82499
82550
  /***/ }),
82500
82551
 
82501
82552
  /***/ "./models/StreamsStyleConfigPlayerStyle.ts":
@@ -82568,6 +82619,30 @@ exports.StreamsStyleConfigResponse = StreamsStyleConfigResponse;
82568
82619
  exports["default"] = StreamsStyleConfigResponse;
82569
82620
 
82570
82621
 
82622
+ /***/ }),
82623
+
82624
+ /***/ "./models/StreamsType.ts":
82625
+ /*!*******************************!*\
82626
+ !*** ./models/StreamsType.ts ***!
82627
+ \*******************************/
82628
+ /***/ ((__unused_webpack_module, exports) => {
82629
+
82630
+ "use strict";
82631
+
82632
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
82633
+ exports.StreamsType = void 0;
82634
+ /**
82635
+ * @export
82636
+ * @enum {string}
82637
+ */
82638
+ var StreamsType;
82639
+ (function (StreamsType) {
82640
+ StreamsType["VIDEO"] = "VIDEO";
82641
+ StreamsType["LIVE"] = "LIVE";
82642
+ })(StreamsType = exports.StreamsType || (exports.StreamsType = {}));
82643
+ exports["default"] = StreamsType;
82644
+
82645
+
82571
82646
  /***/ }),
82572
82647
 
82573
82648
  /***/ "./models/StreamsVideoCreateRequest.ts":
@@ -82679,6 +82754,7 @@ var StreamsVideoQuality;
82679
82754
  StreamsVideoQuality["NONE"] = "NONE";
82680
82755
  StreamsVideoQuality["PREVIEW"] = "PREVIEW";
82681
82756
  StreamsVideoQuality["DEFAULT"] = "DEFAULT";
82757
+ StreamsVideoQuality["TRIMMED"] = "TRIMMED";
82682
82758
  })(StreamsVideoQuality = exports.StreamsVideoQuality || (exports.StreamsVideoQuality = {}));
82683
82759
  exports["default"] = StreamsVideoQuality;
82684
82760
 
@@ -86730,8 +86806,10 @@ __exportStar(__webpack_require__(/*! ./StreamsLiveCreateRequest */ "./models/Str
86730
86806
  __exportStar(__webpack_require__(/*! ./StreamsLiveLifeCycle */ "./models/StreamsLiveLifeCycle.ts"), exports);
86731
86807
  __exportStar(__webpack_require__(/*! ./StreamsLiveResponse */ "./models/StreamsLiveResponse.ts"), exports);
86732
86808
  __exportStar(__webpack_require__(/*! ./StreamsLiveUpdateRequest */ "./models/StreamsLiveUpdateRequest.ts"), exports);
86809
+ __exportStar(__webpack_require__(/*! ./StreamsSearchResponse */ "./models/StreamsSearchResponse.ts"), exports);
86733
86810
  __exportStar(__webpack_require__(/*! ./StreamsStyleConfigPlayerStyle */ "./models/StreamsStyleConfigPlayerStyle.ts"), exports);
86734
86811
  __exportStar(__webpack_require__(/*! ./StreamsStyleConfigResponse */ "./models/StreamsStyleConfigResponse.ts"), exports);
86812
+ __exportStar(__webpack_require__(/*! ./StreamsType */ "./models/StreamsType.ts"), exports);
86735
86813
  __exportStar(__webpack_require__(/*! ./StreamsVideoCreateRequest */ "./models/StreamsVideoCreateRequest.ts"), exports);
86736
86814
  __exportStar(__webpack_require__(/*! ./StreamsVideoEncodingStatus */ "./models/StreamsVideoEncodingStatus.ts"), exports);
86737
86815
  __exportStar(__webpack_require__(/*! ./StreamsVideoEncodingTask */ "./models/StreamsVideoEncodingTask.ts"), exports);
@@ -90428,6 +90506,7 @@ var __extends = (this && this.__extends) || (function () {
90428
90506
  })();
90429
90507
  Object.defineProperty(exports, "__esModule", ({ value: true }));
90430
90508
  var BaseAPI_1 = __webpack_require__(/*! ../common/BaseAPI */ "./common/BaseAPI.ts");
90509
+ var SearchApi_1 = __webpack_require__(/*! ./search/SearchApi */ "./streams/search/SearchApi.ts");
90431
90510
  var VideoApi_1 = __webpack_require__(/*! ./video/VideoApi */ "./streams/video/VideoApi.ts");
90432
90511
  var LiveApi_1 = __webpack_require__(/*! ./live/LiveApi */ "./streams/live/LiveApi.ts");
90433
90512
  /**
@@ -90440,6 +90519,7 @@ var StreamsApi = /** @class */ (function (_super) {
90440
90519
  __extends(StreamsApi, _super);
90441
90520
  function StreamsApi(configuration) {
90442
90521
  var _this = _super.call(this, configuration) || this;
90522
+ _this.search = new SearchApi_1.default(configuration);
90443
90523
  _this.video = new VideoApi_1.default(configuration);
90444
90524
  _this.live = new LiveApi_1.default(configuration);
90445
90525
  return _this;
@@ -90738,6 +90818,118 @@ var StopApi = /** @class */ (function (_super) {
90738
90818
  exports["default"] = StopApi;
90739
90819
 
90740
90820
 
90821
+ /***/ }),
90822
+
90823
+ /***/ "./streams/search/SearchApi.ts":
90824
+ /*!*************************************!*\
90825
+ !*** ./streams/search/SearchApi.ts ***!
90826
+ \*************************************/
90827
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
90828
+
90829
+ "use strict";
90830
+
90831
+ var __extends = (this && this.__extends) || (function () {
90832
+ var extendStatics = function (d, b) {
90833
+ extendStatics = Object.setPrototypeOf ||
90834
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
90835
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
90836
+ return extendStatics(d, b);
90837
+ };
90838
+ return function (d, b) {
90839
+ if (typeof b !== "function" && b !== null)
90840
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
90841
+ extendStatics(d, b);
90842
+ function __() { this.constructor = d; }
90843
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
90844
+ };
90845
+ })();
90846
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
90847
+ var BaseAPI_1 = __webpack_require__(/*! ../../common/BaseAPI */ "./common/BaseAPI.ts");
90848
+ var StreamsSearchResponse_1 = __webpack_require__(/*! ../../models/StreamsSearchResponse */ "./models/StreamsSearchResponse.ts");
90849
+ var PaginationResponse_1 = __webpack_require__(/*! ../../models/PaginationResponse */ "./models/PaginationResponse.ts");
90850
+ var StreamsSearchResponseListQueryParams_1 = __webpack_require__(/*! ./StreamsSearchResponseListQueryParams */ "./streams/search/StreamsSearchResponseListQueryParams.ts");
90851
+ /**
90852
+ * SearchApi - object-oriented interface
90853
+ * @export
90854
+ * @class SearchApi
90855
+ * @extends {BaseAPI}
90856
+ */
90857
+ var SearchApi = /** @class */ (function (_super) {
90858
+ __extends(SearchApi, _super);
90859
+ function SearchApi(configuration) {
90860
+ return _super.call(this, configuration) || this;
90861
+ }
90862
+ /**
90863
+ * @summary Get paginated search results of VOD and Live streams
90864
+ * @param {*} [queryParameters] query parameters for filtering, sorting and pagination
90865
+ * @throws {BitmovinError}
90866
+ * @memberof SearchApi
90867
+ */
90868
+ SearchApi.prototype.list = function (queryParameters) {
90869
+ var queryParams = {};
90870
+ if (typeof queryParameters === 'function') {
90871
+ queryParams = queryParameters(new StreamsSearchResponseListQueryParams_1.StreamsSearchResponseListQueryParamsBuilder()).buildQueryParams();
90872
+ }
90873
+ else if (queryParameters) {
90874
+ queryParams = queryParameters;
90875
+ }
90876
+ return this.restClient.get('/streams/search', {}, queryParams).then(function (response) {
90877
+ return new PaginationResponse_1.default(response, StreamsSearchResponse_1.default);
90878
+ });
90879
+ };
90880
+ return SearchApi;
90881
+ }(BaseAPI_1.BaseAPI));
90882
+ exports["default"] = SearchApi;
90883
+
90884
+
90885
+ /***/ }),
90886
+
90887
+ /***/ "./streams/search/StreamsSearchResponseListQueryParams.ts":
90888
+ /*!****************************************************************!*\
90889
+ !*** ./streams/search/StreamsSearchResponseListQueryParams.ts ***!
90890
+ \****************************************************************/
90891
+ /***/ ((__unused_webpack_module, exports) => {
90892
+
90893
+ "use strict";
90894
+
90895
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
90896
+ exports.StreamsSearchResponseListQueryParamsBuilder = void 0;
90897
+ var StreamsSearchResponseListQueryParamsBuilder = /** @class */ (function () {
90898
+ function StreamsSearchResponseListQueryParamsBuilder() {
90899
+ this.internalParams = {};
90900
+ }
90901
+ /**
90902
+ *
90903
+ * @param offset Index of the first item to return, starting at 0. Default is 0
90904
+ */
90905
+ StreamsSearchResponseListQueryParamsBuilder.prototype.offset = function (offset) {
90906
+ this.internalParams.offset = offset;
90907
+ return this;
90908
+ };
90909
+ /**
90910
+ *
90911
+ * @param limit Maximum number of items to return. Default is 25, maximum is 100
90912
+ */
90913
+ StreamsSearchResponseListQueryParamsBuilder.prototype.limit = function (limit) {
90914
+ this.internalParams.limit = limit;
90915
+ return this;
90916
+ };
90917
+ /**
90918
+ *
90919
+ * @param query Query to search against
90920
+ */
90921
+ StreamsSearchResponseListQueryParamsBuilder.prototype.query = function (query) {
90922
+ this.internalParams.query = query;
90923
+ return this;
90924
+ };
90925
+ StreamsSearchResponseListQueryParamsBuilder.prototype.buildQueryParams = function () {
90926
+ return this.internalParams;
90927
+ };
90928
+ return StreamsSearchResponseListQueryParamsBuilder;
90929
+ }());
90930
+ exports.StreamsSearchResponseListQueryParamsBuilder = StreamsSearchResponseListQueryParamsBuilder;
90931
+
90932
+
90741
90933
  /***/ }),
90742
90934
 
90743
90935
  /***/ "./streams/video/StreamsVideoResponseListQueryParams.ts":
@@ -91000,17 +91192,20 @@ __webpack_require__.r(__webpack_exports__);
91000
91192
  /* harmony export */ Response: () => (/* binding */ Response),
91001
91193
  /* harmony export */ fetch: () => (/* binding */ fetch)
91002
91194
  /* harmony export */ });
91003
- var global =
91195
+ /* eslint-disable no-prototype-builtins */
91196
+ var g =
91004
91197
  (typeof globalThis !== 'undefined' && globalThis) ||
91005
91198
  (typeof self !== 'undefined' && self) ||
91006
- (typeof global !== 'undefined' && global)
91199
+ // eslint-disable-next-line no-undef
91200
+ (typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g) ||
91201
+ {}
91007
91202
 
91008
91203
  var support = {
91009
- searchParams: 'URLSearchParams' in global,
91010
- iterable: 'Symbol' in global && 'iterator' in Symbol,
91204
+ searchParams: 'URLSearchParams' in g,
91205
+ iterable: 'Symbol' in g && 'iterator' in Symbol,
91011
91206
  blob:
91012
- 'FileReader' in global &&
91013
- 'Blob' in global &&
91207
+ 'FileReader' in g &&
91208
+ 'Blob' in g &&
91014
91209
  (function() {
91015
91210
  try {
91016
91211
  new Blob()
@@ -91019,8 +91214,8 @@ var support = {
91019
91214
  return false
91020
91215
  }
91021
91216
  })(),
91022
- formData: 'FormData' in global,
91023
- arrayBuffer: 'ArrayBuffer' in global
91217
+ formData: 'FormData' in g,
91218
+ arrayBuffer: 'ArrayBuffer' in g
91024
91219
  }
91025
91220
 
91026
91221
  function isDataView(obj) {
@@ -91091,6 +91286,9 @@ function Headers(headers) {
91091
91286
  }, this)
91092
91287
  } else if (Array.isArray(headers)) {
91093
91288
  headers.forEach(function(header) {
91289
+ if (header.length != 2) {
91290
+ throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)
91291
+ }
91094
91292
  this.append(header[0], header[1])
91095
91293
  }, this)
91096
91294
  } else if (headers) {
@@ -91161,6 +91359,7 @@ if (support.iterable) {
91161
91359
  }
91162
91360
 
91163
91361
  function consumed(body) {
91362
+ if (body._noBody) return
91164
91363
  if (body.bodyUsed) {
91165
91364
  return Promise.reject(new TypeError('Already read'))
91166
91365
  }
@@ -91188,7 +91387,9 @@ function readBlobAsArrayBuffer(blob) {
91188
91387
  function readBlobAsText(blob) {
91189
91388
  var reader = new FileReader()
91190
91389
  var promise = fileReaderReady(reader)
91191
- reader.readAsText(blob)
91390
+ var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type)
91391
+ var encoding = match ? match[1] : 'utf-8'
91392
+ reader.readAsText(blob, encoding)
91192
91393
  return promise
91193
91394
  }
91194
91395
 
@@ -91226,9 +91427,11 @@ function Body() {
91226
91427
  semantic of setting Request.bodyUsed in the constructor before
91227
91428
  _initBody is called.
91228
91429
  */
91430
+ // eslint-disable-next-line no-self-assign
91229
91431
  this.bodyUsed = this.bodyUsed
91230
91432
  this._bodyInit = body
91231
91433
  if (!body) {
91434
+ this._noBody = true;
91232
91435
  this._bodyText = ''
91233
91436
  } else if (typeof body === 'string') {
91234
91437
  this._bodyText = body
@@ -91276,26 +91479,27 @@ function Body() {
91276
91479
  return Promise.resolve(new Blob([this._bodyText]))
91277
91480
  }
91278
91481
  }
91482
+ }
91279
91483
 
91280
- this.arrayBuffer = function() {
91281
- if (this._bodyArrayBuffer) {
91282
- var isConsumed = consumed(this)
91283
- if (isConsumed) {
91284
- return isConsumed
91285
- }
91286
- if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
91287
- return Promise.resolve(
91288
- this._bodyArrayBuffer.buffer.slice(
91289
- this._bodyArrayBuffer.byteOffset,
91290
- this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
91291
- )
91484
+ this.arrayBuffer = function() {
91485
+ if (this._bodyArrayBuffer) {
91486
+ var isConsumed = consumed(this)
91487
+ if (isConsumed) {
91488
+ return isConsumed
91489
+ } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
91490
+ return Promise.resolve(
91491
+ this._bodyArrayBuffer.buffer.slice(
91492
+ this._bodyArrayBuffer.byteOffset,
91493
+ this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
91292
91494
  )
91293
- } else {
91294
- return Promise.resolve(this._bodyArrayBuffer)
91295
- }
91495
+ )
91296
91496
  } else {
91297
- return this.blob().then(readBlobAsArrayBuffer)
91497
+ return Promise.resolve(this._bodyArrayBuffer)
91298
91498
  }
91499
+ } else if (support.blob) {
91500
+ return this.blob().then(readBlobAsArrayBuffer)
91501
+ } else {
91502
+ throw new Error('could not read as ArrayBuffer')
91299
91503
  }
91300
91504
  }
91301
91505
 
@@ -91330,7 +91534,7 @@ function Body() {
91330
91534
  }
91331
91535
 
91332
91536
  // HTTP methods whose capitalization should be normalized
91333
- var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
91537
+ var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE']
91334
91538
 
91335
91539
  function normalizeMethod(method) {
91336
91540
  var upcased = method.toUpperCase()
@@ -91371,7 +91575,12 @@ function Request(input, options) {
91371
91575
  }
91372
91576
  this.method = normalizeMethod(options.method || this.method || 'GET')
91373
91577
  this.mode = options.mode || this.mode || null
91374
- this.signal = options.signal || this.signal
91578
+ this.signal = options.signal || this.signal || (function () {
91579
+ if ('AbortController' in g) {
91580
+ var ctrl = new AbortController();
91581
+ return ctrl.signal;
91582
+ }
91583
+ }());
91375
91584
  this.referrer = null
91376
91585
 
91377
91586
  if ((this.method === 'GET' || this.method === 'HEAD') && body) {
@@ -91433,7 +91642,11 @@ function parseHeaders(rawHeaders) {
91433
91642
  var key = parts.shift().trim()
91434
91643
  if (key) {
91435
91644
  var value = parts.join(':').trim()
91436
- headers.append(key, value)
91645
+ try {
91646
+ headers.append(key, value)
91647
+ } catch (error) {
91648
+ console.warn('Response ' + error.message)
91649
+ }
91437
91650
  }
91438
91651
  })
91439
91652
  return headers
@@ -91451,6 +91664,9 @@ function Response(bodyInit, options) {
91451
91664
 
91452
91665
  this.type = 'default'
91453
91666
  this.status = options.status === undefined ? 200 : options.status
91667
+ if (this.status < 200 || this.status > 599) {
91668
+ throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].")
91669
+ }
91454
91670
  this.ok = this.status >= 200 && this.status < 300
91455
91671
  this.statusText = options.statusText === undefined ? '' : '' + options.statusText
91456
91672
  this.headers = new Headers(options.headers)
@@ -91470,7 +91686,8 @@ Response.prototype.clone = function() {
91470
91686
  }
91471
91687
 
91472
91688
  Response.error = function() {
91473
- var response = new Response(null, {status: 0, statusText: ''})
91689
+ var response = new Response(null, {status: 200, statusText: ''})
91690
+ response.status = 0
91474
91691
  response.type = 'error'
91475
91692
  return response
91476
91693
  }
@@ -91485,7 +91702,7 @@ Response.redirect = function(url, status) {
91485
91702
  return new Response(null, {status: status, headers: {location: url}})
91486
91703
  }
91487
91704
 
91488
- var DOMException = global.DOMException
91705
+ var DOMException = g.DOMException
91489
91706
  try {
91490
91707
  new DOMException()
91491
91708
  } catch (err) {
@@ -91546,7 +91763,7 @@ function fetch(input, init) {
91546
91763
 
91547
91764
  function fixUrl(url) {
91548
91765
  try {
91549
- return url === '' && global.location.href ? global.location.href : url
91766
+ return url === '' && g.location.href ? g.location.href : url
91550
91767
  } catch (e) {
91551
91768
  return url
91552
91769
  }
@@ -91564,18 +91781,23 @@ function fetch(input, init) {
91564
91781
  if (support.blob) {
91565
91782
  xhr.responseType = 'blob'
91566
91783
  } else if (
91567
- support.arrayBuffer &&
91568
- request.headers.get('Content-Type') &&
91569
- request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1
91784
+ support.arrayBuffer
91570
91785
  ) {
91571
91786
  xhr.responseType = 'arraybuffer'
91572
91787
  }
91573
91788
  }
91574
91789
 
91575
- if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
91790
+ if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {
91791
+ var names = [];
91576
91792
  Object.getOwnPropertyNames(init.headers).forEach(function(name) {
91793
+ names.push(normalizeName(name))
91577
91794
  xhr.setRequestHeader(name, normalizeValue(init.headers[name]))
91578
91795
  })
91796
+ request.headers.forEach(function(value, name) {
91797
+ if (names.indexOf(name) === -1) {
91798
+ xhr.setRequestHeader(name, value)
91799
+ }
91800
+ })
91579
91801
  } else {
91580
91802
  request.headers.forEach(function(value, name) {
91581
91803
  xhr.setRequestHeader(name, value)
@@ -91599,11 +91821,11 @@ function fetch(input, init) {
91599
91821
 
91600
91822
  fetch.polyfill = true
91601
91823
 
91602
- if (!global.fetch) {
91603
- global.fetch = fetch
91604
- global.Headers = Headers
91605
- global.Request = Request
91606
- global.Response = Response
91824
+ if (!g.fetch) {
91825
+ g.fetch = fetch
91826
+ g.Headers = Headers
91827
+ g.Request = Request
91828
+ g.Response = Response
91607
91829
  }
91608
91830
 
91609
91831