protected function getBody(\Psr\Http\Message\MessageInterface $message)
    {
        $body = trim($message->getBody());

        if ($message->getBody()->getSize() === 0 || empty($body)) {
            if ($message instanceof \Psr\Http\Message\ResponseInterface) {
                return 'No response body returned';
            }
            return 'No request body sent';
        }
        $result = json_decode($body);
        if ($result !== null) {
            return json_encode($result, JSON_PRETTY_PRINT);
        }

        return $body;
    }
protected function getBody(\Psr\Http\Message\MessageInterface $message)
    {
        $body = trim($message->getBody());

        if ($message->getBody()->getSize() === 0 || empty($body)) {
            if ($message instanceof \Psr\Http\Message\ResponseInterface) {
                return 'No response body returned';
            }
            return 'No request body sent';
        }
        $result = json_decode($body);
        if ($result !== null) {
            return json_encode($result, JSON_PRETTY_PRINT);
        }

        return $body;
    }
protected function getBody ( \ Psr \ Http \ Message \ MessageInterface $ message ) { $ body = trim ( $ message -> getBody ( ) ) ; if ( $ message -> getBody ( ) -> getSize ( ) === 0 || empty ( $ body ) ) { if ( $ message instanceof \ Psr \ Http \ Message \ ResponseInterface ) { return 'No response body returned' ; } return 'No request body sent' ; } $ result = json_decode ( $ body ) ; if ( $ result !== null ) { return json_encode ( $ result , JSON_PRETTY_PRINT ) ; } return $ body ; }
Get response body

@param \Psr\Http\Message\MessageInterface $message

@return string
Get response body