@smithy/fetch-http-handler 3.0.3 → 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
@@ -149,11 +149,16 @@ var _FetchHttpHandler = class _FetchHttpHandler {
149
149
  if (abortSignal) {
150
150
  raceOfPromises.push(
151
151
  new Promise((resolve, reject) => {
152
- abortSignal.onabort = () => {
152
+ const onAbort = /* @__PURE__ */ __name(() => {
153
153
  const abortError = new Error("Request aborted");
154
154
  abortError.name = "AbortError";
155
155
  reject(abortError);
156
- };
156
+ }, "onAbort");
157
+ if (typeof abortSignal.addEventListener === "function") {
158
+ abortSignal.addEventListener("abort", onAbort);
159
+ } else {
160
+ abortSignal.onabort = onAbort;
161
+ }
157
162
  })
158
163
  );
159
164
  }
@@ -99,11 +99,17 @@ export class FetchHttpHandler {
99
99
  ];
100
100
  if (abortSignal) {
101
101
  raceOfPromises.push(new Promise((resolve, reject) => {
102
- abortSignal.onabort = () => {
102
+ const onAbort = () => {
103
103
  const abortError = new Error("Request aborted");
104
104
  abortError.name = "AbortError";
105
105
  reject(abortError);
106
106
  };
107
+ if (typeof abortSignal.addEventListener === "function") {
108
+ abortSignal.addEventListener("abort", onAbort);
109
+ }
110
+ else {
111
+ abortSignal.onabort = onAbort;
112
+ }
107
113
  }));
108
114
  }
109
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",
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.1",
28
- "@smithy/querystring-builder": "^3.0.1",
29
- "@smithy/types": "^3.1.0",
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.1",
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",