hyper
hyper copied to clipboard
Response without a body receives `Transfer-Encoding: chunked`
I want a server to make a 304 Not Modified response like this:
Response::new()
.with_status(StatusCode::NotModified)
.with_header(ETag(etag))
.with_header(LastModified(last_modified))
My problem is hyper sees the response without body (or without Content-Length) and adds a Transfer-Encoding: chunked to the headers (here's the culprit).
Am I using the API wrong or is this an error on hyper's side?
It's a bug in hyper. I've been working on this week actually, to better handle when message shouldn't have bodies. Besides 304, also 204, and also when the request verb would not allow a response body, like HEAD or CONNECT.
Great to hear it's being resolved and thank you for fixing this!