src/Http/Helpers.php
public static function fixContentLength(MessageInterface $response): MessageInterface
    {
        $size = $response->getBody()->getSize();
        if ($size !== null) {
            return $response->withHeader('Content-Length', (string) $size);
        }

        return $response->withoutHeader('Content-Length');
    }
public static function fixContentLength(MessageInterface $response): MessageInterface
    {
        $size = $response->getBody()->getSize();
        if ($size !== null) {
            return $response->withHeader('Content-Length', (string) $size);
        }

        return $response->withoutHeader('Content-Length');
    }
public static function fixContentLength ( MessageInterface $ response ) : MessageInterface { $ size = $ response -> getBody ( ) -> getSize ( ) ; if ( $ size !== null ) { return $ response -> withHeader ( 'Content-Length' , ( string ) $ size ) ; } return $ response -> withoutHeader ( 'Content-Length' ) ; }
Add or remove the Content-Length header
Used by middlewares that modify the body content

@param MessageInterface $response

@return MessageInterface
Add or remove the Content - Length header Used by middlewares that modify the body content