aws-sdk 2.1658.0 → 2.1659.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/dist/aws-sdk.js CHANGED
@@ -1,4 +1,4 @@
1
- // AWS SDK for JavaScript v2.1658.0
1
+ // AWS SDK for JavaScript v2.1659.0
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // License at https://sdk.amazonaws.com/js/BUNDLE_LICENSE.txt
4
4
  (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
@@ -276293,7 +276293,7 @@ AWS.util.update(AWS, {
276293
276293
  /**
276294
276294
  * @constant
276295
276295
  */
276296
- VERSION: '2.1658.0',
276296
+ VERSION: '2.1659.0',
276297
276297
 
276298
276298
  /**
276299
276299
  * @api private
@@ -287556,17 +287556,21 @@ AWS.util.update(AWS.S3.prototype, {
287556
287556
  * @api private
287557
287557
  */
287558
287558
  extractErrorFrom200Response: function extractErrorFrom200Response(resp) {
287559
- if (!operationsWith200StatusCodeError[resp.request.operation]) return;
287559
+ var service = this.service ? this.service : this;
287560
+ if (!service.is200Error(resp) && !operationsWith200StatusCodeError[resp.request.operation]) {
287561
+ return;
287562
+ }
287560
287563
  var httpResponse = resp.httpResponse;
287561
- if (httpResponse.body && httpResponse.body.toString().match('<Error>')) {
287564
+ var bodyString = httpResponse.body && httpResponse.body.toString() || '';
287565
+ if (bodyString && bodyString.indexOf('</Error>') === bodyString.length - 8) {
287562
287566
  // Response body with '<Error>...</Error>' indicates an exception.
287563
287567
  // Get S3 client object. In ManagedUpload, this.service refers to
287564
287568
  // S3 client object.
287565
287569
  resp.data = null;
287566
- var service = this.service ? this.service : this;
287567
287570
  service.extractError(resp);
287571
+ resp.error.is200Error = true;
287568
287572
  throw resp.error;
287569
- } else if (!httpResponse.body || !httpResponse.body.toString().match(/<[\w_]/)) {
287573
+ } else if (!httpResponse.body || !bodyString.match(/<[\w_]/)) {
287570
287574
  // When body is empty or incomplete, S3 might stop the request on detecting client
287571
287575
  // side aborting the request.
287572
287576
  resp.data = null;
@@ -287577,13 +287581,54 @@ AWS.util.update(AWS.S3.prototype, {
287577
287581
  }
287578
287582
  },
287579
287583
 
287584
+ /**
287585
+ * @api private
287586
+ * @param resp - to evaluate.
287587
+ * @return true if the response has status code 200 but is an error.
287588
+ */
287589
+ is200Error: function is200Error(resp) {
287590
+ var code = resp && resp.httpResponse && resp.httpResponse.statusCode;
287591
+ if (code !== 200) {
287592
+ return false;
287593
+ }
287594
+ try {
287595
+ var req = resp.request;
287596
+ var outputMembers = req.service.api.operations[req.operation].output.members;
287597
+ var keys = Object.keys(outputMembers);
287598
+ for (var i = 0; i < keys.length; ++i) {
287599
+ var member = outputMembers[keys[i]];
287600
+ if (member.type === 'binary' && member.isStreaming) {
287601
+ return false;
287602
+ }
287603
+ }
287604
+
287605
+ var body = resp.httpResponse.body;
287606
+ if (body && body.byteLength !== undefined) {
287607
+ if (body.byteLength < 15 || body.byteLength > 3000) {
287608
+ // body is too short or long to be an error message.
287609
+ return false;
287610
+ }
287611
+ }
287612
+ if (!body) {
287613
+ return false;
287614
+ }
287615
+ var bodyString = body.toString();
287616
+ if (bodyString.indexOf('</Error>') === bodyString.length - 8) {
287617
+ return true;
287618
+ }
287619
+ } catch (e) {
287620
+ return false;
287621
+ }
287622
+ return false;
287623
+ },
287624
+
287580
287625
  /**
287581
287626
  * @return [Boolean] whether the error can be retried
287582
287627
  * @api private
287583
287628
  */
287584
287629
  retryableError: function retryableError(error, request) {
287585
- if (operationsWith200StatusCodeError[request.operation] &&
287586
- error.statusCode === 200) {
287630
+ if (error.is200Error ||
287631
+ (operationsWith200StatusCodeError[request.operation] && error.statusCode === 200)) {
287587
287632
  return true;
287588
287633
  } else if (request._requestRegionForBucket &&
287589
287634
  request.service.bucketRegionCache[request._requestRegionForBucket]) {
@@ -298565,7 +298610,7 @@ var LRUCache = /** @class */ (function () {
298565
298610
  }());
298566
298611
  exports.LRUCache = LRUCache;
298567
298612
  },{}],467:[function(require,module,exports){
298568
- // AWS SDK for JavaScript v2.1658.0
298613
+ // AWS SDK for JavaScript v2.1659.0
298569
298614
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
298570
298615
  // License at https://sdk.amazonaws.com/js/BUNDLE_LICENSE.txt
298571
298616
  require('./browser_loader');