Skip to content

Commit

Permalink
feat(volo-http): avoid unnecessary router params vec expansion (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarisW authored Oct 11, 2024
1 parent dde1176 commit c7e4fc8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion volo-http/src/server/route/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ where
) -> Result<Self::Response, Self::Error> {
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;
}
}
Expand Down

0 comments on commit c7e4fc8

Please sign in to comment.