@digitraffic/common 2024.6.14-1 → 2024.6.14-2
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.
@@ -45,5 +45,15 @@ describe("acl-builder tests", () => {
|
|
45
45
|
.withThrottleAnonymousUserIp(200)
|
46
46
|
.build()).toThrow();
|
47
47
|
});
|
48
|
+
test("throtle rule without limit does nothing", () => {
|
49
|
+
for (const aclBuilder of [
|
50
|
+
createBuilder().withThrottleDigitrafficUserIp(undefined),
|
51
|
+
createBuilder().withThrottleDigitrafficUserIpAndUriPath(undefined),
|
52
|
+
createBuilder().withThrottleAnonymousUserIp(null),
|
53
|
+
createBuilder().withThrottleAnonymousUserIpAndUriPath(null)
|
54
|
+
]) {
|
55
|
+
expect(() => aclBuilder.build()).toThrowError('No rules');
|
56
|
+
}
|
57
|
+
});
|
48
58
|
});
|
49
59
|
//# sourceMappingURL=acl-builder.test.mjs.map
|
@@ -20,10 +20,10 @@ export declare class AclBuilder {
|
|
20
20
|
withIpRestrictionRule(addresses: string[]): AclBuilder;
|
21
21
|
withThrottleRule(name: string, priority: number, limit: number, customResponseBodyKey: string, isHeaderRequired: boolean, isBasedOnIpAndUriPath: boolean): AclBuilder;
|
22
22
|
withCustomResponseBody(key: string, customResponseBody: CfnWebACL.CustomResponseBodyProperty): this;
|
23
|
-
withThrottleDigitrafficUserIp(limit: number): AclBuilder;
|
24
|
-
withThrottleDigitrafficUserIpAndUriPath(limit: number): AclBuilder;
|
25
|
-
withThrottleAnonymousUserIp(limit: number): AclBuilder;
|
26
|
-
withThrottleAnonymousUserIpAndUriPath(limit: number): AclBuilder;
|
23
|
+
withThrottleDigitrafficUserIp(limit: number | null | undefined): AclBuilder;
|
24
|
+
withThrottleDigitrafficUserIpAndUriPath(limit: number | null | undefined): AclBuilder;
|
25
|
+
withThrottleAnonymousUserIp(limit: number | null | undefined): AclBuilder;
|
26
|
+
withThrottleAnonymousUserIpAndUriPath(limit: number | null | undefined): AclBuilder;
|
27
27
|
_isCustomResponseBodyKeySet(key: string): boolean;
|
28
28
|
_addThrottleResponseBody(customResponseBodyKey: string, limit: number): void;
|
29
29
|
_logMissingLimit(method: string): void;
|