add support for brotli compression

This commit is contained in:
Athou
2026-10-14 07:37:31 +02:00
parent 69c1e8a5b8
commit b865b3ff84
4 changed files with 14 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
package com.commafeed.backend;
import com.aayushatharva.brotli4j.encoder.BrotliOutputStream;
import com.codahale.metrics.MetricRegistry;
import com.commafeed.CommaFeedConfiguration;
import com.commafeed.CommaFeedVersion;
@@ -418,7 +419,7 @@ class HttpGetterTest {
@Nested
class Compression {
private static final String ACCEPT_ENCODING = "deflate, gzip, zstd";
private static final String ACCEPT_ENCODING = "deflate, gzip, zstd, br";
@Test
void gzip() throws Exception {
@@ -435,6 +436,11 @@ class HttpGetterTest {
supportsCompression("zstd", ZstdOutputStream::new);
}
@Test
void br() throws Exception {
supportsCompression("br", BrotliOutputStream::new);
}
void supportsCompression(String encoding, CompressionFunction compressionFunction)
throws Exception {
String body = "my body";