Code review comment: @galderz Being a test framework, I think it could do better at letting you tweak the headers manually. The topic is not new to the RestAssured GitHub though. I will make a TODO to follow up.

Code before review:
public static void runTest(String endpoint, String acceptEncoding, String contentEncoding, String contentLength) {
LOG.infof("Endpoint %s; Accept-Encoding: %s; Content-Encoding: %s; Content-Length: %s",
endpoint, acceptEncoding, contentEncoding, contentLength);
final WebClient client = WebClient.create(Vertx.vertx(), new WebClientOptions()
.setLogActivity(true)
.setFollowRedirects(true)
.setDecompressionSupported(false));
final CompletableFuture<HttpResponse<Buffer>> future = new CompletableFuture<>();
client.requestAbs(HttpMethod.GET, endpoint)
.putHeader(HttpHeaders.ACCEPT_ENCODING.toString(), acceptEncoding)
.putHeader(HttpHeaders.ACCEPT.toString(), "*/*")
.putHeader(HttpHeaders.USER_AGENT.toString(), "Tester")
.send(ar -> {
if (ar.succeeded()) {
future.complete(ar.result());
} else {
future.completeExceptionally(ar.cause());
}
});
try {
final HttpResponse<Buffer> response = future.get();
final String actualEncoding = response.headers().get("content-encoding");
assertEquals(OK.code(), response.statusCode(),
"Http status must be OK.");
assertEquals(contentEncoding, actualEncoding,
"Unexpected compressor selected.");
final int receivedLength = parseInt(response.headers().get("content-length"));
final int expectedLength = parseInt(contentLength);
assertTrue(receivedLength <= expectedLength,
"Compression apparently failed: receivedLength: " + receivedLength + ", expectedLength: " + expectedLength);
final String body;
if (actualEncoding != null && !"identity".equalsIgnoreCase(actualEncoding)) {
EmbeddedChannel channel = null;
if ("gzip".equalsIgnoreCase(actualEncoding)) {
channel = new EmbeddedChannel(newZlibDecoder(ZlibWrapper.GZIP));
} else if ("deflate".equalsIgnoreCase(actualEncoding)) {
channel = new EmbeddedChannel(newZlibDecoder(ZlibWrapper.ZLIB));
} else if ("br".equalsIgnoreCase(actualEncoding)) {
channel = new EmbeddedChannel(new BrotliDecoder());
} else {
fail("Unexpected compression used by server: " + actualEncoding);
}
channel.writeInbound(Unpooled.copiedBuffer(response.body().getBytes()));
channel.finish();
final ByteBuf decompressed = channel.readInbound();
body = decompressed.readCharSequence(decompressed.readableBytes(), StandardCharsets.UTF_8).toString();
} else {
body = response.body().toString(StandardCharsets.UTF_8);
}
assertEquals(TEXT, body,
"Unexpected body text.");
} catch (InterruptedException | ExecutionException e) {
fail(e);
}
}

Line under review: .setFollowRedirects(true)

Code after addressing the review:
public static void runTest(String endpoint, String acceptEncoding, String contentEncoding, String contentLength) {
LOG.infof("Endpoint %s; Accept-Encoding: %s; Content-Encoding: %s; Content-Length: %s",
endpoint, acceptEncoding, contentEncoding, contentLength);
final WebClient client = WebClient.create(Vertx.vertx(), new WebClientOptions()
.setLogActivity(true)
.setFollowRedirects(true)
.setDecompressionSupported(false));
final CompletableFuture<HttpResponse<Buffer>> future = new CompletableFuture<>();
client.requestAbs(HttpMethod.GET, endpoint)
.putHeader(HttpHeaders.ACCEPT_ENCODING.toString(), acceptEncoding)
.putHeader(HttpHeaders.ACCEPT.toString(), "*/*")
.putHeader(HttpHeaders.USER_AGENT.toString(), "Tester")
.send(ar -> {
if (ar.succeeded()) {
future.complete(ar.result());
} else {
future.completeExceptionally(ar.cause());
}
});
try {
final HttpResponse<Buffer> response = future.get();
final String actualEncoding = response.headers().get("content-encoding");
assertEquals(OK.code(), response.statusCode(),
"Http status must be OK.");
assertEquals(contentEncoding, actualEncoding,
"Unexpected compressor selected.");
final int receivedLength = parseInt(response.headers().get("content-length"));
final int expectedLength = parseInt(contentLength);
if (contentEncoding == null) {
assertEquals(expectedLength, receivedLength,
"No compression was expected, so the content-length must match exactly.");
} else {
final int expectedLengthWithTolerance = expectedLength + (expectedLength / 100 * COMPRESSION_TOLERANCE_PERCENT);
assertTrue(receivedLength <= expectedLengthWithTolerance,
"Compression apparently failed: receivedLength: " + receivedLength +
" was supposed to be less or equal to expectedLength: " +
expectedLength + " plus " + COMPRESSION_TOLERANCE_PERCENT + "% tolerance, i.e. "
+ expectedLengthWithTolerance + ".");
}
final String body;
if (actualEncoding != null && !"identity".equalsIgnoreCase(actualEncoding)) {
EmbeddedChannel channel = null;
if ("gzip".equalsIgnoreCase(actualEncoding)) {
channel = new EmbeddedChannel(newZlibDecoder(ZlibWrapper.GZIP));
} else if ("deflate".equalsIgnoreCase(actualEncoding)) {
channel = new EmbeddedChannel(newZlibDecoder(ZlibWrapper.ZLIB));
} else if ("br".equalsIgnoreCase(actualEncoding)) {
channel = new EmbeddedChannel(new BrotliDecoder());
} else {
fail("Unexpected compression used by server: " + actualEncoding);
}
channel.writeInbound(Unpooled.copiedBuffer(response.body().getBytes()));
channel.finish();
final ByteBuf decompressed = channel.readInbound();
body = decompressed.readCharSequence(decompressed.readableBytes(), StandardCharsets.UTF_8).toString();
} else {
body = response.body().toString(StandardCharsets.UTF_8);
}
assertEquals(TEXT, body,
"Unexpected body text.");
} catch (InterruptedException | ExecutionException e) {
fail(e);
}
}