Use the target device's registration ID in the GET /v1/keys/identifier/deviceId ratelimit

This commit is contained in:
Katherine
2025-08-18 13:15:45 -04:00
committed by GitHub
parent b76eaa1098
commit 4acb3b5ac7
2 changed files with 30 additions and 4 deletions

View File

@@ -371,8 +371,16 @@ class KeysControllerTest {
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD))
.get();
final String expectedRatelimitKey = String.format("%s.%s__%s.%s.%s",
AuthHelper.VALID_UUID,
AuthHelper.VALID_DEVICE.getId(),
EXISTS_PNI,
"*",
"*");
assertThat(result.getStatus()).isEqualTo(429);
assertThat(result.getHeaderString("Retry-After")).isEqualTo(String.valueOf(retryAfter.toSeconds()));
verify(rateLimiter).validate(expectedRatelimitKey);
}
@Test