spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

When building `DELETE` requests, the request body is not used in `JdkClientHttpRequest.buildRequest`

Open lazysasha opened this issue 5 months ago • 0 comments

After switching from spring-web:6.2.6 to spring-web:6.2.8 one of the tests in our app stopped working. After some investigation we found out that TestRestTemplate was not sending a request body when making a DELETE request:

val body = HttpEntity("""["1","2"]""", headers)
testRestTemplate.exchange("/v1/messages", HttpMethod.DELETE, body, String::class.java).also {
   assertEquals(HttpStatus.OK, it.statusCode)
}

Digging a bit further, we found out that in spring-web:6.2.8 this logic has been introduced, which eventually creates a DELETE request without a body:

@Override
public HttpRequest.Builder DELETE() {
    return method0("DELETE", null);
}

Could someone have a look at it please?

Let me know if you need more information.

lazysasha avatar Jun 17 '25 07:06 lazysasha