Skip to content

Clients created using JdkClientHttpRequestFactory set content-length for GET, DELETE and HEAD requests #34971

Closed
@zkorhone

Description

@zkorhone

Current implementation that builds HTTP client request is:

builder.method(this.method.name(), bodyPublisher(headers, body));

This results in creating a GET request without a body.

This however isn't internally the same as not setting publisher at all (openjdk/jdk@6a77093).

Unfortunately you must always pass the published for this method. While you could file a bug against JDK, getting a fix will take far longer than addressing this in Spring.

I believe what is required is to change Spring's algorithm to something that checks if there is a body and if the request method is one of GET, DELETE, or HEAD. If it is, then one should call matching method in the request builder.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions