Description
When sending a GET
request (no body) using the Jetty client sometimes it sends multiple network-level requests and uses Transfer-Encoding: chunked
. From local testing manually setting content-length
to 0
means this issue does not occur.
I've tried to produce a test with TestContext
from cats-effect
but trying to use the Jetty client leads to a deadlock (I can create it and tear it down with no issues).
If I had to guess I would say this is due to a race between the Jetty request being sent and the content for that request being populated, the lines are here:
If the request sends (jReq.send(rl)
) before the delayed content has written (dcp.write(req)
, dcp
is a StreamRequestContentProvider
) the request will be chunked.
Possibly just inverting these lines might mean the race is less likely? Unless are that way around for a reason (send before write).
http4s version: 0.21.0-M5
. Sorry, only just realised this isn't the latest but I think there have been no changes between versions.