Hello,

Context I'am using Spring Cloud Gateway to forward requests between 2 applications. After upgrading to Spring Boot 3.5.x and Spring MVC 6.2.8, there is an issue on DELETE requests with body. The body is not send anymore.

Issue org.springframework.http.client.JdkClientHttpRequest don't send body when the request is a DELETE request

    private HttpRequest buildRequest(HttpHeaders headers, @Nullable Body body) {
        HttpRequest.Builder builder = HttpRequest.newBuilder().uri(this.uri);

        headers.forEach((headerName, headerValues) -> {
            if (!DISALLOWED_HEADERS.contains(headerName.toLowerCase(Locale.ROOT))) {
                for (String headerValue : headerValues) {
                    builder.header(headerName, headerValue);
                }
            }
        });

        switch (this.method.name()) {
            case "GET" :
                builder.GET();
                break;
            case "DELETE" :
                builder.DELETE();
                break;
            default :
                builder.method(this.method.name(), bodyPublisher(headers, body));
        }
        return builder.build();
    }

Correction Just delete the case "DELETE"

DELETE method may have a body https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/DELETE

I think is wrong to not send it. Other implementations of ClientHttpRequest send the body without any check (org.springframework.http.client.JettyClientHttpRequest, org.springframework.http.client.SimpleClientHttpRequest,...)

Thank you

Comment From: bclozel

Duplicates #35068