protected function getOutputResponse(
        ServerRequestInterface $request,
        ResponseInterface $response
    ) : ResponseInterface {
        ob_start();
        switch ($this->determineOutputType()) {
            case self::TYPE_JSON:
                $this->renderJSON($request, $response);
                break;
            case self::TYPE_XML:
                $this->renderXML($request, $response);
                break;
            case self::TYPE_PLAIN:
                $this->renderPlainText($request, $response);
                break;
            default:
                $this->renderHTML($request, $response);
                break;
        }

        $output = ob_get_clean();
        $body = new RequestBody();
        // write handler
        $body->write($output);
        return $response->withStatus(404)->withBody($body);
    }