public function addMiddleware(callable $middleware) {
        $next = $this->middleware;

        $this->middleware = function (HttpRequest $request) use ($middleware, $next): HttpResponse {
            return $middleware($request, $next);
        };

        return $this;
    }