Improve body handling for HEAD responses
This patch was authored and released by @tanner0101.
Improves logic for handling HEAD responses (#2310).
Previously when HEAD requests were detected, the response body would be replaced with an empty body and the content-length
header would be re-added. This caused problems with responses that don't use the content-length
header, even for non-HEAD requests.
Now, when HEAD requests are detected, the response body is not changed. Instead, a flag is set signaling the serializer to skip serialization of the body.