private function _send($message)
    {
        // Errors come from HTTPException. This helps set the proper envelope data
        /** @var Response $response */
        $response = $this->di->get('response');
        $response->setStatusCode($this->httpCode, $this->httpMessage);

        // HEAD does everything exactly the same as GET, but contains no body
        // empty responses (such as a 204 result) should also skip JSON configuration
        if ($this->head || !$message) {
            $response->setContentType(null); //forces content-type to not be sent
        } else {
            $jsonConfig = $this->di->get('config')['application']['debugApp'] ? JSON_PRETTY_PRINT : 0;
            $response->setJsonContent($message, $jsonConfig);
        }

        $response->send();
    }
private function _send($message)
    {
        // Errors come from HTTPException. This helps set the proper envelope data
        /** @var Response $response */
        $response = $this->di->get('response');
        $response->setStatusCode($this->httpCode, $this->httpMessage);

        // HEAD does everything exactly the same as GET, but contains no body
        // empty responses (such as a 204 result) should also skip JSON configuration
        if ($this->head || !$message) {
            $response->setContentType(null); //forces content-type to not be sent
        } else {
            $jsonConfig = $this->di->get('config')['application']['debugApp'] ? JSON_PRETTY_PRINT : 0;
            $response->setJsonContent($message, $jsonConfig);
        }

        $response->send();
    }
private function _send ( $ message ) { // Errors come from HTTPException. This helps set the proper envelope data /** @var Response $response */ $ response = $ this -> di -> get ( 'response' ) ; $ response -> setStatusCode ( $ this -> httpCode , $ this -> httpMessage ) ; // HEAD does everything exactly the same as GET, but contains no body // empty responses (such as a 204 result) should also skip JSON configuration if ( $ this -> head || ! $ message ) { $ response -> setContentType ( null ) ; //forces content-type to not be sent } else { $ jsonConfig = $ this -> di -> get ( 'config' ) [ 'application' ] [ 'debugApp' ] ? JSON_PRETTY_PRINT : 0 ; $ response -> setJsonContent ( $ message , $ jsonConfig ) ; } $ response -> send ( ) ; }
for a given string message, prepare a basic json response for the browser

@param string $message
for a given string message prepare a basic json response for the browser