Skip to content

Commit

Permalink
fix: Revert to abort-controller from npm package in fetchHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
msarcev committed Nov 20, 2023
1 parent 05abdb2 commit 4c46520
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
},
"engines": {
"node": ">=16 <=16.20.2"

},
"dependencies": {
"@google-cloud/logging-winston": "^5.3.0",
Expand All @@ -39,6 +38,7 @@
"@iota/util.js": "^1.8.6",
"@iota/validators": "^1.0.0-beta.30",
"@types/node-cron": "^3.0.2",
"abort-controller": "^3.0.0",
"aws-sdk": "^2.1205.0",
"big-integer": "^1.6.51",
"compression": "^1.7.4",
Expand Down
3 changes: 2 additions & 1 deletion api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const configAllowedHeaders: string | undefined =
if (Array.isArray(config.allowedDomains)) {
for (const dom of config.allowedDomains) {
if (dom.indexOf("*") > 0) {
configAllowedDomains.push(new RegExp(dom.replaceAll("*", "(.*)")));
// eslint-disable-next-line unicorn/prefer-string-replace-all
configAllowedDomains.push(new RegExp(dom.replace(/\*/g, "(.*)")));
} else {
configAllowedDomains.push(dom);
}
Expand Down
8 changes: 5 additions & 3 deletions api/src/utils/fetchHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line import/no-named-as-default
import AbortController from "abort-controller";
import fetch from "node-fetch";

/**
Expand Down Expand Up @@ -37,7 +37,8 @@ export class FetchHelper {
controller.abort();
}
},
timeout);
timeout
);
}

try {
Expand All @@ -48,7 +49,8 @@ export class FetchHelper {
headers,
body: payload ? JSON.stringify(payload) : undefined,
signal: controller ? controller.signal : undefined
});
}
);

const json = await res.json();
return json as U;
Expand Down

0 comments on commit 4c46520

Please sign in to comment.