@smithy/fetch-http-handler 4.1.3 → 5.0.1
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-cjs/index.js +8 -9
- package/package.json +9 -6
package/dist-cjs/index.js
CHANGED
|
@@ -54,13 +54,16 @@ __name(requestTimeout, "requestTimeout");
|
|
|
54
54
|
var keepAliveSupport = {
|
|
55
55
|
supported: void 0
|
|
56
56
|
};
|
|
57
|
-
var
|
|
57
|
+
var FetchHttpHandler = class _FetchHttpHandler {
|
|
58
|
+
static {
|
|
59
|
+
__name(this, "FetchHttpHandler");
|
|
60
|
+
}
|
|
58
61
|
/**
|
|
59
62
|
* @returns the input if it is an HttpHandler of any class,
|
|
60
63
|
* or instantiates a new instance of this handler.
|
|
61
64
|
*/
|
|
62
65
|
static create(instanceOrOptions) {
|
|
63
|
-
if (typeof
|
|
66
|
+
if (typeof instanceOrOptions?.handle === "function") {
|
|
64
67
|
return instanceOrOptions;
|
|
65
68
|
}
|
|
66
69
|
return new _FetchHttpHandler(instanceOrOptions);
|
|
@@ -81,14 +84,13 @@ var _FetchHttpHandler = class _FetchHttpHandler {
|
|
|
81
84
|
destroy() {
|
|
82
85
|
}
|
|
83
86
|
async handle(request, { abortSignal } = {}) {
|
|
84
|
-
var _a;
|
|
85
87
|
if (!this.config) {
|
|
86
88
|
this.config = await this.configProvider;
|
|
87
89
|
}
|
|
88
90
|
const requestTimeoutInMs = this.config.requestTimeout;
|
|
89
91
|
const keepAlive = this.config.keepAlive === true;
|
|
90
92
|
const credentials = this.config.credentials;
|
|
91
|
-
if (abortSignal
|
|
93
|
+
if (abortSignal?.aborted) {
|
|
92
94
|
const abortError = new Error("Request aborted");
|
|
93
95
|
abortError.name = "AbortError";
|
|
94
96
|
return Promise.reject(abortError);
|
|
@@ -116,7 +118,7 @@ var _FetchHttpHandler = class _FetchHttpHandler {
|
|
|
116
118
|
method,
|
|
117
119
|
credentials
|
|
118
120
|
};
|
|
119
|
-
if (
|
|
121
|
+
if (this.config?.cache) {
|
|
120
122
|
requestOptions.cache = this.config.cache;
|
|
121
123
|
}
|
|
122
124
|
if (body) {
|
|
@@ -194,14 +196,11 @@ var _FetchHttpHandler = class _FetchHttpHandler {
|
|
|
194
196
|
return this.config ?? {};
|
|
195
197
|
}
|
|
196
198
|
};
|
|
197
|
-
__name(_FetchHttpHandler, "FetchHttpHandler");
|
|
198
|
-
var FetchHttpHandler = _FetchHttpHandler;
|
|
199
199
|
|
|
200
200
|
// src/stream-collector.ts
|
|
201
201
|
var import_util_base64 = require("@smithy/util-base64");
|
|
202
202
|
var streamCollector = /* @__PURE__ */ __name(async (stream) => {
|
|
203
|
-
|
|
204
|
-
if (typeof Blob === "function" && stream instanceof Blob || ((_a = stream.constructor) == null ? void 0 : _a.name) === "Blob") {
|
|
203
|
+
if (typeof Blob === "function" && stream instanceof Blob || stream.constructor?.name === "Blob") {
|
|
205
204
|
if (Blob.prototype.arrayBuffer !== void 0) {
|
|
206
205
|
return new Uint8Array(await stream.arrayBuffer());
|
|
207
206
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/fetch-http-handler",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Provides a way to make requests",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"module": "./dist-es/index.js",
|
|
28
28
|
"types": "./dist-types/index.d.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@smithy/protocol-http": "^
|
|
31
|
-
"@smithy/querystring-builder": "^
|
|
32
|
-
"@smithy/types": "^
|
|
33
|
-
"@smithy/util-base64": "^
|
|
30
|
+
"@smithy/protocol-http": "^5.0.1",
|
|
31
|
+
"@smithy/querystring-builder": "^4.0.1",
|
|
32
|
+
"@smithy/types": "^4.1.0",
|
|
33
|
+
"@smithy/util-base64": "^4.0.0",
|
|
34
34
|
"tslib": "^2.6.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@smithy/abort-controller": "^
|
|
37
|
+
"@smithy/abort-controller": "^4.0.1",
|
|
38
38
|
"concurrently": "7.0.0",
|
|
39
39
|
"downlevel-dts": "0.10.1",
|
|
40
40
|
"rimraf": "3.0.2",
|
|
@@ -61,5 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"directory": ".release/package"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=18.0.0"
|
|
64
67
|
}
|
|
65
68
|
}
|