src/Util.php
/**
     * Inject the Content-Length header if is not already present.
     *
     * @param \Psr\Http\Message\ResponseInterface $response
     *
     * @return \Psr\Http\Message\ResponseInterface
     */
Inject the Content-Length header if is not already present.


Inject the Content - Length header if is not already present .
public static function injectContentLength(ResponseInterface $response): ResponseInterface
    {
        if (! $response->hasHeader('Content-Length') &&
            $response->getBody()->getSize() !== null
        ) {
            $response = $response->withHeader('Content-Length', (string) $response->getBody()->getSize());
        }
        return $response;
    }
public static function injectContentLength ( ResponseInterface $ response ) : ResponseInterface { if ( ! $ response -> hasHeader ( 'Content-Length' ) && $ response -> getBody ( ) -> getSize ( ) !== null ) { $ response = $ response -> withHeader ( 'Content-Length' , ( string ) $ response -> getBody ( ) -> getSize ( ) ) ; } return $ response ; }
Inject the Content-Length header if is not already present.
Inject the Content - Length header if is not already present .
// PSR-7 indicates int OR null for the stream size; for null values, // we will not auto-inject the Content-Length.