-
Notifications
You must be signed in to change notification settings - Fork 691
Description
Hello,
As a potential side-effect of this change: #3603 , when sending a POST with no body, the content-length: 0 is no longer there.
Sample code:
public static void main(String[] args) {
DisposableServer server = HttpServer.create().host("localhost").handle((request, response) -> {
request.requestHeaders().forEach(header -> System.out.println(header.getKey() + ": " + header.getValue()));
return response.status(200).send();
}).bindNow();
WebClient.builder()
.build()
.method(POST)
.uri("http://"+server.host() + ":" + server.port())
.retrieve().bodyToMono(Void.class).block();
}
Using the default webClient config, the behaviour back in 1.0.39 was the following:
accept-encoding: gzip
user-agent: ReactorNetty/1.0.39
host: 127.0.0.1:55767
accept: /
transfer-encoding: chunked
Then in 1.2.2:
accept-encoding: gzip
user-agent: ReactorNetty/1.2.2
host: 127.0.0.1:56881
accept: /
content-length: 0
And now in 1.2.3:
accept-encoding: gzip
user-agent: ReactorNetty/1.2.3
host: 127.0.0.1:56837
accept: /
Some servers require either 'transfer-encoding: chunked' or 'content-length', but since there's no body in the POST, the correct recommended behaviour is to send a content-length: 0, I would like to know why it was removed knowing that the referenced issue only references 'GET' requests which is understandable since it's not recommended to have a body, but why impact the POST flow? https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2
Kindly advise.
Thank you.