From 131c1d42227eeda2d42436c5285426bf3f787df0 Mon Sep 17 00:00:00 2001 From: "val.istar.guo" Date: Wed, 22 May 2024 18:00:08 +0800 Subject: [PATCH] fix: composeMiddleware should not change parameters --- src/util/compose-middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/compose-middleware.ts b/src/util/compose-middleware.ts index 19d3d17..652a721 100644 --- a/src/util/compose-middleware.ts +++ b/src/util/compose-middleware.ts @@ -9,7 +9,7 @@ export function composeMiddleware(middlewares: KeqMiddleware[]): KeqMiddleware { throw new Exception('At least one middleware') } - const middleware = middlewares + const middleware = [...middlewares] .reverse() .reduce(function (prev, curr): KeqMiddleware { return async (ctx, next) => {