RestContext::processResponseBody PHP 메소드

processResponseBody() 보호된 메소드

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
리턴 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;
        }
    }