mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 05:26:53 +00:00
Add metric for content-length header distribution
This commit is contained in:
1 parent
d1ada7f998
commit
3e01bc1174
3 files changed
+75
-1
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2021 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.filters;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import javax.ws.rs.container.ContainerRequestContext;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.whispersystems.textsecuregcm.metrics.TrafficSource;
|
||||
|
||||
class ContentLengthFilterTest {
|
||||
|
||||
@Test
|
||||
void testFilter() throws Exception {
|
||||
|
||||
final ContentLengthFilter contentLengthFilter = new ContentLengthFilter(TrafficSource.WEBSOCKET);
|
||||
|
||||
final ContainerRequestContext requestContext = mock(ContainerRequestContext.class);
|
||||
|
||||
when(requestContext.getLength()).thenReturn(-1);
|
||||
when(requestContext.getLength()).thenReturn(Integer.MAX_VALUE);
|
||||
when(requestContext.getLength()).thenThrow(RuntimeException.class);
|
||||
|
||||
contentLengthFilter.filter(requestContext);
|
||||
contentLengthFilter.filter(requestContext);
|
||||
contentLengthFilter.filter(requestContext);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user