babashka/http-client

Allow `:body` be `java.net.http.HttpRequest$BodyPublisher` instance

Closed this issue · 0 comments

Now :body is converted to java.net.http.HttpRequest$BodyPublisher which then be used to create the java.net.http.HttpRequest. The converter now does not support java.net.http.HttpRequest$BodyPublisher directly.

HttpClient use BodyPublisher's contentLength as the request header's content-length. And notice that directly setting content-length is restricted somehow. This is the scenario when I encountered the problem (when use stream as body, the request's content-length could not be set; the stream is a wrapped one which we know the exactly size).