src/Utils/Http.php
public static function doesRequestHaveBody(RequestInterface $request)
    {
        if ($request->hasHeader('Transfer-Encoding')) {
            return true;
        };

        if (!$contentLength = $request->getHeader('Content-Length')) {
            return false;
        }

        return 0 < $contentLength[0];
    }
public static function doesRequestHaveBody(RequestInterface $request)
    {
        if ($request->hasHeader('Transfer-Encoding')) {
            return true;
        };

        if (!$contentLength = $request->getHeader('Content-Length')) {
            return false;
        }

        return 0 < $contentLength[0];
    }
public static function doesRequestHaveBody ( RequestInterface $ request ) { if ( $ request -> hasHeader ( 'Transfer-Encoding' ) ) { return true ; } ; if ( ! $ contentLength = $ request -> getHeader ( 'Content-Length' ) ) { return false ; } return 0 < $ contentLength [ 0 ] ; }
Does the HTTP request contain body content?

"The presence of a message-body in a request is signaled by the inclusion of a Content-Length or
Transfer-Encoding header field in the request's message-headers."
https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3

However, some browsers send a Content-Length header with an empty string for e.g. GET requests
without any message-body. Therefore rather than checking for the existence of a Content-Length
header, we will allow an empty value to indicate that the request does not contain body.

@param RequestInterface $request
@return bool
Does the HTTP request contain body content?