From c7e4fc8ef142b6fb4d2f16879764230ae79299f3 Mon Sep 17 00:00:00 2001 From: StellarisW Date: Fri, 11 Oct 2024 11:57:59 +0800 Subject: [PATCH] feat(volo-http): avoid unnecessary router params vec expansion (#508) --- volo-http/src/server/route/router.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/volo-http/src/server/route/router.rs b/volo-http/src/server/route/router.rs index 6b087d30..a4e41e36 100644 --- a/volo-http/src/server/route/router.rs +++ b/volo-http/src/server/route/router.rs @@ -419,7 +419,9 @@ where ) -> Result { if let Ok(matched) = self.matcher.at(req.uri().clone().path()) { if let Some(route) = self.routes.get(matched.value) { - cx.params_mut().extend(matched.params); + if !matched.params.is_empty() { + cx.params_mut().extend(matched.params); + } return route.call(cx, req).await; } }