@aws-sdk/xhr-http-handler
Advanced tools
Comparing version 3.721.0 to 3.723.0
@@ -59,12 +59,10 @@ "use strict"; | ||
}; | ||
var _XhrHttpHandler = class _XhrHttpHandler extends import_events.EventEmitter { | ||
constructor(options) { | ||
super(); | ||
if (typeof options === "function") { | ||
this.configProvider = options(); | ||
} else { | ||
this.config = options ?? {}; | ||
this.configProvider = Promise.resolve(this.config); | ||
} | ||
var XhrHttpHandler = class _XhrHttpHandler extends import_events.EventEmitter { | ||
static { | ||
__name(this, "XhrHttpHandler"); | ||
} | ||
static EVENTS = EVENTS; | ||
static ERROR_IDENTIFIER = "XHR_HTTP_HANDLER_ERROR"; | ||
config; | ||
configProvider; | ||
/** | ||
@@ -75,3 +73,3 @@ * @returns the input if it is an HttpHandler of any class, | ||
static create(instanceOrOptions) { | ||
if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { | ||
if (typeof instanceOrOptions?.handle === "function") { | ||
return instanceOrOptions; | ||
@@ -81,2 +79,11 @@ } | ||
} | ||
constructor(options) { | ||
super(); | ||
if (typeof options === "function") { | ||
this.configProvider = options(); | ||
} else { | ||
this.config = options ?? {}; | ||
this.configProvider = Promise.resolve(this.config); | ||
} | ||
} | ||
updateHttpClientConfig(key, value) { | ||
@@ -99,3 +106,3 @@ this.config = void 0; | ||
const requestTimeoutInMs = Number(this.config.requestTimeout) | 0; | ||
if (abortSignal == null ? void 0 : abortSignal.aborted) { | ||
if (abortSignal?.aborted) { | ||
const abortError = new Error("Request aborted"); | ||
@@ -150,3 +157,2 @@ abortError.name = "AbortError"; | ||
const body2 = (() => { | ||
var _a; | ||
if (isArrayBuffer) { | ||
@@ -156,3 +162,3 @@ return new Blob([xhr.response]); | ||
if (isText) { | ||
streamCursor !== xhr.responseText.length && ((_a = writer.write) == null ? void 0 : _a.call(writer, streamCursor > 0 ? xhr.responseText.slice(streamCursor) : xhr.responseText)); | ||
streamCursor !== xhr.responseText.length && writer.write?.(streamCursor > 0 ? xhr.responseText.slice(streamCursor) : xhr.responseText); | ||
writer.releaseLock(); | ||
@@ -245,6 +251,2 @@ stream.writable.close(); | ||
}; | ||
__name(_XhrHttpHandler, "XhrHttpHandler"); | ||
_XhrHttpHandler.EVENTS = EVENTS; | ||
_XhrHttpHandler.ERROR_IDENTIFIER = "XHR_HTTP_HANDLER_ERROR"; | ||
var XhrHttpHandler = _XhrHttpHandler; | ||
var isForbiddenRequestHeader = /* @__PURE__ */ __name((header) => { | ||
@@ -251,0 +253,0 @@ header = header.toLowerCase(); |
@@ -20,2 +20,6 @@ import { HttpResponse } from "@smithy/protocol-http"; | ||
export class XhrHttpHandler extends EventEmitter { | ||
static EVENTS = EVENTS; | ||
static ERROR_IDENTIFIER = "XHR_HTTP_HANDLER_ERROR"; | ||
config; | ||
configProvider; | ||
static create(instanceOrOptions) { | ||
@@ -186,4 +190,2 @@ if (typeof instanceOrOptions?.handle === "function") { | ||
} | ||
XhrHttpHandler.EVENTS = EVENTS; | ||
XhrHttpHandler.ERROR_IDENTIFIER = "XHR_HTTP_HANDLER_ERROR"; | ||
const isForbiddenRequestHeader = (header) => { | ||
@@ -190,0 +192,0 @@ header = header.toLowerCase(); |
{ | ||
"name": "@aws-sdk/xhr-http-handler", | ||
"version": "3.721.0", | ||
"version": "3.723.0", | ||
"description": "Provides a way to make requests using XMLHttpRequest", | ||
@@ -23,6 +23,6 @@ "scripts": { | ||
"dependencies": { | ||
"@aws-sdk/types": "3.714.0", | ||
"@smithy/protocol-http": "^4.1.8", | ||
"@smithy/querystring-builder": "^3.0.11", | ||
"@smithy/types": "^3.7.2", | ||
"@aws-sdk/types": "3.723.0", | ||
"@smithy/protocol-http": "^5.0.0", | ||
"@smithy/querystring-builder": "^4.0.0", | ||
"@smithy/types": "^4.0.0", | ||
"events": "3.3.0", | ||
@@ -32,3 +32,3 @@ "tslib": "^2.6.2" | ||
"devDependencies": { | ||
"@smithy/abort-controller": "^3.1.9", | ||
"@smithy/abort-controller": "^4.0.0", | ||
"@tsconfig/recommended": "1.0.1", | ||
@@ -38,3 +38,3 @@ "concurrently": "7.0.0", | ||
"rimraf": "3.0.2", | ||
"typescript": "~4.9.5" | ||
"typescript": "~5.2.2" | ||
}, | ||
@@ -41,0 +41,0 @@ "typesVersions": { |
623
39492
+ Added@aws-sdk/types@3.723.0(transitive)
+ Added@smithy/protocol-http@5.0.1(transitive)
+ Added@smithy/querystring-builder@4.0.1(transitive)
+ Added@smithy/types@4.1.0(transitive)
+ Added@smithy/util-uri-escape@4.0.0(transitive)
- Removed@aws-sdk/types@3.714.0(transitive)
- Removed@smithy/protocol-http@4.1.8(transitive)
- Removed@smithy/querystring-builder@3.0.11(transitive)
- Removed@smithy/types@3.7.2(transitive)
- Removed@smithy/util-uri-escape@3.0.0(transitive)
Updated@aws-sdk/types@3.723.0
Updated@smithy/protocol-http@^5.0.0
Updated@smithy/types@^4.0.0