@smithy/fetch-http-handler 3.0.3 → 3.2.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 +10 -3
- package/dist-es/fetch-http-handler.js +9 -1
- package/package.json +6 -6
package/dist-cjs/index.js
CHANGED
|
@@ -80,6 +80,7 @@ var _FetchHttpHandler = class _FetchHttpHandler {
|
|
|
80
80
|
}
|
|
81
81
|
const requestTimeoutInMs = this.config.requestTimeout;
|
|
82
82
|
const keepAlive = this.config.keepAlive === true;
|
|
83
|
+
const credentials = this.config.credentials;
|
|
83
84
|
if (abortSignal == null ? void 0 : abortSignal.aborted) {
|
|
84
85
|
const abortError = new Error("Request aborted");
|
|
85
86
|
abortError.name = "AbortError";
|
|
@@ -105,7 +106,8 @@ var _FetchHttpHandler = class _FetchHttpHandler {
|
|
|
105
106
|
const requestOptions = {
|
|
106
107
|
body,
|
|
107
108
|
headers: new Headers(request.headers),
|
|
108
|
-
method
|
|
109
|
+
method,
|
|
110
|
+
credentials
|
|
109
111
|
};
|
|
110
112
|
if (body) {
|
|
111
113
|
requestOptions.duplex = "half";
|
|
@@ -149,11 +151,16 @@ var _FetchHttpHandler = class _FetchHttpHandler {
|
|
|
149
151
|
if (abortSignal) {
|
|
150
152
|
raceOfPromises.push(
|
|
151
153
|
new Promise((resolve, reject) => {
|
|
152
|
-
|
|
154
|
+
const onAbort = /* @__PURE__ */ __name(() => {
|
|
153
155
|
const abortError = new Error("Request aborted");
|
|
154
156
|
abortError.name = "AbortError";
|
|
155
157
|
reject(abortError);
|
|
156
|
-
};
|
|
158
|
+
}, "onAbort");
|
|
159
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
160
|
+
abortSignal.addEventListener("abort", onAbort);
|
|
161
|
+
} else {
|
|
162
|
+
abortSignal.onabort = onAbort;
|
|
163
|
+
}
|
|
157
164
|
})
|
|
158
165
|
);
|
|
159
166
|
}
|
|
@@ -31,6 +31,7 @@ export class FetchHttpHandler {
|
|
|
31
31
|
}
|
|
32
32
|
const requestTimeoutInMs = this.config.requestTimeout;
|
|
33
33
|
const keepAlive = this.config.keepAlive === true;
|
|
34
|
+
const credentials = this.config.credentials;
|
|
34
35
|
if (abortSignal?.aborted) {
|
|
35
36
|
const abortError = new Error("Request aborted");
|
|
36
37
|
abortError.name = "AbortError";
|
|
@@ -57,6 +58,7 @@ export class FetchHttpHandler {
|
|
|
57
58
|
body,
|
|
58
59
|
headers: new Headers(request.headers),
|
|
59
60
|
method: method,
|
|
61
|
+
credentials,
|
|
60
62
|
};
|
|
61
63
|
if (body) {
|
|
62
64
|
requestOptions.duplex = "half";
|
|
@@ -99,11 +101,17 @@ export class FetchHttpHandler {
|
|
|
99
101
|
];
|
|
100
102
|
if (abortSignal) {
|
|
101
103
|
raceOfPromises.push(new Promise((resolve, reject) => {
|
|
102
|
-
|
|
104
|
+
const onAbort = () => {
|
|
103
105
|
const abortError = new Error("Request aborted");
|
|
104
106
|
abortError.name = "AbortError";
|
|
105
107
|
reject(abortError);
|
|
106
108
|
};
|
|
109
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
110
|
+
abortSignal.addEventListener("abort", onAbort);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
abortSignal.onabort = onAbort;
|
|
114
|
+
}
|
|
107
115
|
}));
|
|
108
116
|
}
|
|
109
117
|
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.2.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.3",
|
|
28
|
+
"@smithy/querystring-builder": "^3.0.3",
|
|
29
|
+
"@smithy/types": "^3.3.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.
|
|
34
|
+
"@smithy/abort-controller": "^3.1.1",
|
|
35
35
|
"concurrently": "7.0.0",
|
|
36
36
|
"downlevel-dts": "0.10.1",
|
|
37
37
|
"rimraf": "3.0.2",
|