RestContext::processResponseBody PHP Method

processResponseBody() protected method

Process response body. This method may also be used by other context(s) to process REST API call and inject response body into this context by using 2nd parameter $asJson.
protected processResponseBody ( string $jsonData, boolean $asJson = true ) : void
$jsonData string
$asJson boolean
return void
    protected function processResponseBody($jsonData, $asJson = true)
    {
        if ($asJson) {
            try {
                $this->responseData = $this->decodeJson($jsonData);
                $this->responseIsJson = true;
                $this->responseDecodeException = null;
            } catch (\Exception $e) {
                $this->responseData = $jsonData;
                $this->responseIsJson = false;
                $this->responseDecodeException = $e;
            }
        } else {
            $this->responseData = $jsonData;
            $this->responseIsJson = false;
            $this->responseDecodeException = null;
        }
    }