diff --git a/reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConnect.java b/reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConnect.java index 4199e37fe..a4750cab5 100644 --- a/reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConnect.java +++ b/reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConnect.java @@ -551,7 +551,6 @@ Publisher requestWithBody(HttpClientOperations ch) { if (!Objects.equals(method, HttpMethod.GET) && !Objects.equals(method, HttpMethod.HEAD) && - !Objects.equals(method, HttpMethod.DELETE) && !headers.contains(HttpHeaderNames.CONTENT_LENGTH)) { ch.chunkedTransfer(true); } diff --git a/reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java b/reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java index 5f2358c70..21c3e1b69 100644 --- a/reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java +++ b/reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java @@ -99,6 +99,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -3489,4 +3490,27 @@ void testIssue3416() { .expectComplete() .verify(Duration.ofSeconds(5)); } + + @ParameterizedTest + @ValueSource(booleans = {true, false}) + void testDeleteMethod(boolean chunked) { + disposableServer = + createServer() + .handle((req, res) -> res.send(req.receive().retain())) + .bindNow(); + + Publisher body = chunked ? + ByteBufFlux.fromString(Flux.just("d", "e", "l", "e", "t", "e")) : + ByteBufMono.fromString(Mono.just("delete")); + + createClient(disposableServer.port()) + .delete() + .uri("/") + .send(body) + .responseSingle((res, bytes) -> bytes.asString()) + .as(StepVerifier::create) + .expectNext("delete") + .expectComplete() + .verify(Duration.ofSeconds(5)); + } }