public static function doesResponseHaveBody($request, $response)
    {
        if ('HEAD' === strtoupper($request->getMethod())) {
            return false;
        }

        $status = $response->getStatusCode();

        if ((100 <= $status && 200 > $status) || 204 === $status || 304 === $status) {
            return false;
        }

        if (self::hasHeader($response, 'Transfer-Encoding')) {
            return true;
        };

        if (!$contentLength = self::getHeader($response, 'Content-Length')) {
            return false;
        }

        return 0 < $contentLength[0];
    }