@smithy/fetch-http-handler 3.0.2 → 3.1.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-cjs/index.js
CHANGED
|
@@ -46,7 +46,7 @@ __name(requestTimeout, "requestTimeout");
|
|
|
46
46
|
|
|
47
47
|
// src/fetch-http-handler.ts
|
|
48
48
|
var keepAliveSupport = {
|
|
49
|
-
supported:
|
|
49
|
+
supported: void 0
|
|
50
50
|
};
|
|
51
51
|
var _FetchHttpHandler = class _FetchHttpHandler {
|
|
52
52
|
/**
|
|
@@ -66,6 +66,11 @@ var _FetchHttpHandler = class _FetchHttpHandler {
|
|
|
66
66
|
this.config = options ?? {};
|
|
67
67
|
this.configProvider = Promise.resolve(this.config);
|
|
68
68
|
}
|
|
69
|
+
if (keepAliveSupport.supported === void 0) {
|
|
70
|
+
keepAliveSupport.supported = Boolean(
|
|
71
|
+
typeof Request !== "undefined" && "keepalive" in new Request("https://[::1]")
|
|
72
|
+
);
|
|
73
|
+
}
|
|
69
74
|
}
|
|
70
75
|
destroy() {
|
|
71
76
|
}
|
|
@@ -144,11 +149,16 @@ var _FetchHttpHandler = class _FetchHttpHandler {
|
|
|
144
149
|
if (abortSignal) {
|
|
145
150
|
raceOfPromises.push(
|
|
146
151
|
new Promise((resolve, reject) => {
|
|
147
|
-
|
|
152
|
+
const onAbort = /* @__PURE__ */ __name(() => {
|
|
148
153
|
const abortError = new Error("Request aborted");
|
|
149
154
|
abortError.name = "AbortError";
|
|
150
155
|
reject(abortError);
|
|
151
|
-
};
|
|
156
|
+
}, "onAbort");
|
|
157
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
158
|
+
abortSignal.addEventListener("abort", onAbort);
|
|
159
|
+
} else {
|
|
160
|
+
abortSignal.onabort = onAbort;
|
|
161
|
+
}
|
|
152
162
|
})
|
|
153
163
|
);
|
|
154
164
|
}
|
|
@@ -2,7 +2,7 @@ import { HttpResponse } from "@smithy/protocol-http";
|
|
|
2
2
|
import { buildQueryString } from "@smithy/querystring-builder";
|
|
3
3
|
import { requestTimeout } from "./request-timeout";
|
|
4
4
|
export const keepAliveSupport = {
|
|
5
|
-
supported:
|
|
5
|
+
supported: undefined,
|
|
6
6
|
};
|
|
7
7
|
export class FetchHttpHandler {
|
|
8
8
|
static create(instanceOrOptions) {
|
|
@@ -19,6 +19,9 @@ export class FetchHttpHandler {
|
|
|
19
19
|
this.config = options ?? {};
|
|
20
20
|
this.configProvider = Promise.resolve(this.config);
|
|
21
21
|
}
|
|
22
|
+
if (keepAliveSupport.supported === undefined) {
|
|
23
|
+
keepAliveSupport.supported = Boolean(typeof Request !== "undefined" && "keepalive" in new Request("https://[::1]"));
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
destroy() {
|
|
24
27
|
}
|
|
@@ -96,11 +99,17 @@ export class FetchHttpHandler {
|
|
|
96
99
|
];
|
|
97
100
|
if (abortSignal) {
|
|
98
101
|
raceOfPromises.push(new Promise((resolve, reject) => {
|
|
99
|
-
|
|
102
|
+
const onAbort = () => {
|
|
100
103
|
const abortError = new Error("Request aborted");
|
|
101
104
|
abortError.name = "AbortError";
|
|
102
105
|
reject(abortError);
|
|
103
106
|
};
|
|
107
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
108
|
+
abortSignal.addEventListener("abort", onAbort);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
abortSignal.onabort = onAbort;
|
|
112
|
+
}
|
|
104
113
|
}));
|
|
105
114
|
}
|
|
106
115
|
return Promise.race(raceOfPromises);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/fetch-http-handler",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
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'",
|
|
7
7
|
"build:cjs": "node ../../scripts/inline fetch-http-handler",
|
|
8
8
|
"build:es": "yarn g:tsc -p tsconfig.es.json",
|
|
9
9
|
"build:types": "yarn g:tsc -p tsconfig.types.json",
|
|
10
|
-
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
10
|
+
"build:types:downlevel": "rimraf dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
|
|
11
11
|
"stage-release": "rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
|
|
12
12
|
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
|
|
13
13
|
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"module": "./dist-es/index.js",
|
|
25
25
|
"types": "./dist-types/index.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@smithy/protocol-http": "^4.0.
|
|
28
|
-
"@smithy/querystring-builder": "^3.0.
|
|
29
|
-
"@smithy/types": "^3.
|
|
27
|
+
"@smithy/protocol-http": "^4.0.2",
|
|
28
|
+
"@smithy/querystring-builder": "^3.0.2",
|
|
29
|
+
"@smithy/types": "^3.2.0",
|
|
30
30
|
"@smithy/util-base64": "^3.0.0",
|
|
31
31
|
"tslib": "^2.6.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@smithy/abort-controller": "^3.0
|
|
34
|
+
"@smithy/abort-controller": "^3.1.0",
|
|
35
35
|
"concurrently": "7.0.0",
|
|
36
36
|
"downlevel-dts": "0.10.1",
|
|
37
37
|
"rimraf": "3.0.2",
|