protected function response($mixed): ResponseInterface
    {
        $statusCode = 200;
        $reasonPhrase = '';
        $headers['Content-Type'] = ['application/json'];
        $body = new Stream();

        // Booleans
        if (is_bool($mixed)) {
            if ($mixed == false) {
                $statusCode = 500;
            }
        } else {
            // Array
            if (is_array($mixed)) {
                $body->write(json_encode($mixed));
            } else {
                // Exception
                if ($mixed instanceof \Exception) {
                    if ($mixed instanceof RoutingException) {
                        $statusCode = $mixed->getCode();
                        $reasonPhrase = $mixed->getMessage();
                    } else {
                        $statusCode = 500;
                    }

                    $body->write(json_encode(['errno' => $mixed->getCode(), 'error' => $mixed->getMessage()]));
                } else {
                    // Object
                    if (is_object($mixed)) {
                        if ($mixed instanceof \JsonSerializable) {
                            $body->write(json_encode($mixed));
                        } else {
                            throw new BerliozException('Parameter object must implement \JsonSerializable interface to be converted');
                        }
                    } else {
                        $statusCode = 500;
                    }
                }
            }
        }

        // Response
        return new Response($body, $statusCode, $headers, $reasonPhrase);
    }