Skip to content

Commit b4d1a60

Browse files
committed
fix var name
1 parent 76fea6d commit b4d1a60

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

modules/web/router_path.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ import (
1616
)
1717

1818
type RouterPathGroup struct {
19-
r *Router
20-
pathParam string
21-
processors []*routerPathMatcher
19+
r *Router
20+
pathParam string
21+
matchers []*routerPathMatcher
2222
}
2323

2424
func (g *RouterPathGroup) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
2525
chiCtx := chi.RouteContext(req.Context())
2626
path := chiCtx.URLParam(g.pathParam)
27-
for _, p := range g.processors {
28-
if p.matchPath(chiCtx, path) {
29-
handler := p.handlerFunc
30-
for i := len(p.middlewares) - 1; i >= 0; i-- {
31-
handler = p.middlewares[i](handler).ServeHTTP
27+
for _, m := range g.matchers {
28+
if m.matchPath(chiCtx, path) {
29+
handler := m.handlerFunc
30+
for i := len(m.middlewares) - 1; i >= 0; i-- {
31+
handler = m.middlewares[i](handler).ServeHTTP
3232
}
3333
handler(resp, req)
3434
return
@@ -42,7 +42,7 @@ func (g *RouterPathGroup) ServeHTTP(resp http.ResponseWriter, req *http.Request)
4242
// It is only designed to resolve some special cases which chi router can't handle.
4343
// For most cases, it shouldn't be used because it needs to iterate all rules to find the matched one (inefficient).
4444
func (g *RouterPathGroup) MatchPath(methods, pattern string, h ...any) {
45-
g.processors = append(g.processors, newRouterPathMatcher(methods, pattern, h...))
45+
g.matchers = append(g.matchers, newRouterPathMatcher(methods, pattern, h...))
4646
}
4747

4848
type routerPathParam struct {

0 commit comments

Comments
 (0)