src/Http/Message.php
protected function _setContentLength()
    {
        $headers = $this->headers();
        if ($headers['Transfer-Encoding']->value() === 'chunked') {
            return;
        }
        $length = $this->stream()->length();
        if ($length === null) {
            throw new NetException("A Content-Length header is required but the request stream has a `null` length.");
        }

        $headers['Content-Length'] = $this->stream()->length();
    }
protected function _setContentLength()
    {
        $headers = $this->headers();
        if ($headers['Transfer-Encoding']->value() === 'chunked') {
            return;
        }
        $length = $this->stream()->length();
        if ($length === null) {
            throw new NetException("A Content-Length header is required but the request stream has a `null` length.");
        }

        $headers['Content-Length'] = $this->stream()->length();
    }
protected function _setContentLength ( ) { $ headers = $ this -> headers ( ) ; if ( $ headers [ 'Transfer-Encoding' ] -> value ( ) === 'chunked' ) { return ; } $ length = $ this -> stream ( ) -> length ( ) ; if ( $ length === null ) { throw new NetException ( "A Content-Length header is required but the request stream has a `null` length." ) ; } $ headers [ 'Content-Length' ] = $ this -> stream ( ) -> length ( ) ; }
Auto adds a Content-Length header if necessary.
Auto adds a Content - Length header if necessary .