fix(server): do not automatically set ContentLength for 204 and 304 Responses

This commit is contained in:
Sean McArthur
2017-07-04 12:52:41 -07:00
parent 81c0d185bd
commit c4c89a22f8

View File

@@ -131,9 +131,16 @@ impl Http1Transaction for ServerTransaction {
body
}
fn should_set_length(_head: &MessageHead<Self::Outgoing>) -> bool {
fn should_set_length(head: &MessageHead<Self::Outgoing>) -> bool {
//TODO: pass method, check if method == HEAD
true
match head.subject {
// TODO: support for 1xx codes needs improvement everywhere
// would be 100...199 => false
StatusCode::NoContent |
StatusCode::NotModified => false,
_ => true,
}
}
}