Skip to content

Commit 0b4c9b5

Browse files
committed
exclude methods impact and explain
1 parent 2cfe6df commit 0b4c9b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/router/request_matcher/method.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ impl<T: RouteData> RequestMatcher<T> for MethodMatcher<T> {
8989
fn trace(&self, request: &Request) -> Vec<Trace<T>> {
9090
let mut traces = self.any_method.trace(request);
9191
let request_method = request.method();
92+
let mut found = false;
9293

9394
for (methods, matcher) in &self.exclude_methods {
9495
if !methods.contains(&request_method.into()) {
96+
found = true;
9597
let method_traces = matcher.trace(request);
9698

9799
traces.push(Trace::new(
@@ -120,6 +122,7 @@ impl<T: RouteData> RequestMatcher<T> for MethodMatcher<T> {
120122

121123
for (method, matcher) in &self.methods {
122124
if method == request_method {
125+
found = true;
123126
let method_traces = matcher.trace(request);
124127

125128
traces.push(Trace::new(
@@ -146,7 +149,7 @@ impl<T: RouteData> RequestMatcher<T> for MethodMatcher<T> {
146149
}
147150
}
148151

149-
if !self.methods.contains_key(request_method) {
152+
if !found {
150153
traces.push(Trace::new(
151154
true,
152155
false,

0 commit comments

Comments
 (0)