@digitraffic/common 2026.2.5-3 → 2026.2.10-1
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.
|
@@ -14,6 +14,10 @@ const baseHeaders = {
|
|
|
14
14
|
"Accept-Encoding": "gzip",
|
|
15
15
|
Accept: "*/*",
|
|
16
16
|
};
|
|
17
|
+
// Step name can only contain letters, numbers, hyphens, underscores, periods, and spaces
|
|
18
|
+
function sanitizeStepName(url) {
|
|
19
|
+
return url.replace(/auth=.*/, "").replace(/[^a-zA-Z0-9\-_. ]/g, " ");
|
|
20
|
+
}
|
|
17
21
|
export class UrlChecker {
|
|
18
22
|
requestOptions;
|
|
19
23
|
constructor(hostname, apiKey) {
|
|
@@ -50,7 +54,7 @@ export class UrlChecker {
|
|
|
50
54
|
path: url,
|
|
51
55
|
},
|
|
52
56
|
};
|
|
53
|
-
await synthetics.executeHttpStep(`Verify ${statusCode} for ${url
|
|
57
|
+
await synthetics.executeHttpStep(`Verify ${statusCode} for ${sanitizeStepName(url)}`, requestOptions, callback);
|
|
54
58
|
}
|
|
55
59
|
expect200(url, ...callbacks) {
|
|
56
60
|
const callback = async (json, body, res) => {
|
|
@@ -65,7 +69,7 @@ export class UrlChecker {
|
|
|
65
69
|
path: url,
|
|
66
70
|
},
|
|
67
71
|
};
|
|
68
|
-
return synthetics.executeHttpStep(`Verify 404 for ${url}`, requestOptions, validateStatusCodeAndContentType(404, MediaType.TEXT_PLAIN));
|
|
72
|
+
return synthetics.executeHttpStep(`Verify 404 for ${sanitizeStepName(url)}`, requestOptions, validateStatusCodeAndContentType(404, MediaType.TEXT_PLAIN));
|
|
69
73
|
}
|
|
70
74
|
expect400(url) {
|
|
71
75
|
const requestOptions = {
|
|
@@ -74,7 +78,7 @@ export class UrlChecker {
|
|
|
74
78
|
path: url,
|
|
75
79
|
},
|
|
76
80
|
};
|
|
77
|
-
return synthetics.executeHttpStep(`Verify 400 for ${url}`, requestOptions, validateStatusCodeAndContentType(400, MediaType.TEXT_PLAIN));
|
|
81
|
+
return synthetics.executeHttpStep(`Verify 400 for ${sanitizeStepName(url)}`, requestOptions, validateStatusCodeAndContentType(400, MediaType.TEXT_PLAIN));
|
|
78
82
|
}
|
|
79
83
|
expect403WithoutApiKey(url, mediaType) {
|
|
80
84
|
if (!this.requestOptions.headers ||
|
|
@@ -92,7 +96,7 @@ export class UrlChecker {
|
|
|
92
96
|
headers: baseHeaders,
|
|
93
97
|
},
|
|
94
98
|
};
|
|
95
|
-
return synthetics.executeHttpStep(`Verify 403 for ${url}`, requestOptions, validateStatusCodeAndContentType(403, mediaType ?? MediaType.APPLICATION_JSON));
|
|
99
|
+
return synthetics.executeHttpStep(`Verify 403 for ${sanitizeStepName(url)}`, requestOptions, validateStatusCodeAndContentType(403, mediaType ?? MediaType.APPLICATION_JSON));
|
|
96
100
|
}
|
|
97
101
|
done() {
|
|
98
102
|
return "Canary successful";
|