Open aturon opened 3 years ago
Hmmm, so you have a custom type implementing size_hint
that returns a possible range instead of an exact size, is that right? It does seem that if you declare there is some size hint, it should mean the body should be sent with a transfer-encoding: chunked
header. Is that what you'd expect as well?
I have a custom type that, depending on the situation, may return the default size hint (unbounded), or else an exact size. My surprise was that for a GET request, the size hint affected whether the body was sent at all. I would expect that if Hyper drops the body when making GET requests, it would so so in all cases, regardless of the size hint for the body.
I see, I'm starting to remember now. So, while very rare, it's legal to send a body with a GET. So hyper settled on these rules, currently:
content-length
or transfer-encoding
header explicitly, that wins.content-length
.transfer-encoding
body, which would possibly be empty and thus the server will find it weird.Roger that! Thanks for the clarification. If this is intended behavior, I wonder if it could be added to documentation, in case others trip over the same issue.
I think this is subtly related to https://github.com/hyperium/hyper/issues/2427
This is a subtle one! Bodies for GET requests are ignored, unless the
HttpBody::size_hint
provides an exact size, in which case they are transmitted. Thesize_hint
should not affect behavior in this way, AIUI.I was using the general
Client::request
API to pass through a request that happened to be aGET
with a body.