We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98fb7aa commit c826628Copy full SHA for c826628
src/cnames.js
@@ -152,10 +152,15 @@ const generateCNAMEsFile = async (cnames, file) => {
152
*/
153
const testUrl = async url => {
154
let resp;
155
+ const controller = new AbortController();
156
+ const timer = setTimeout(() => controller.abort(), 5000);
157
try {
- resp = await fetch(url, { timeout: 5000 });
158
+ resp = await fetch(url, { signal: controller.signal });
159
} catch (err) {
160
+ if (err.name === "AbortError") return "Failed due to time out after 5s"
161
return `Failed during request with error '${err}'`
162
+ } finally {
163
+ clearTimeout(timer);
164
}
165
if (!resp.ok) {
166
return `Failed with status code '${resp.status} ${resp.statusText}'`
0 commit comments