@@ -65,3 +65,41 @@ func TestGroupRouteMiddleware(t *testing.T) {
65
65
c , _ = request (http .MethodGet , "/group/405" , e )
66
66
assert .Equal (t , 405 , c )
67
67
}
68
+
69
+ func TestGroupRouteMiddlewareWithMatchAny (t * testing.T ) {
70
+ // Ensure middleware and match any routes do not conflict
71
+ e := New ()
72
+ g := e .Group ("/group" )
73
+ m1 := func (next HandlerFunc ) HandlerFunc {
74
+ return func (c Context ) error {
75
+ return next (c )
76
+ }
77
+ }
78
+ m2 := func (next HandlerFunc ) HandlerFunc {
79
+ return func (c Context ) error {
80
+ return c .String (http .StatusOK , c .Path ())
81
+ }
82
+ }
83
+ h := func (c Context ) error {
84
+ return c .String (http .StatusOK , c .Path ())
85
+ }
86
+ g .Use (m1 )
87
+ g .GET ("/help" , h , m2 )
88
+ g .GET ("/*" , h , m2 )
89
+ g .GET ("" , h , m2 )
90
+ e .GET ("*" , h , m2 )
91
+
92
+ _ , m := request (http .MethodGet , "/group/help" , e )
93
+ assert .Equal (t , "/group/help" , m )
94
+ _ , m = request (http .MethodGet , "/group/help/other" , e )
95
+ assert .Equal (t , "/group/*" , m )
96
+ _ , m = request (http .MethodGet , "/group/404" , e )
97
+ assert .Equal (t , "/group/*" , m )
98
+ _ , m = request (http .MethodGet , "/group" , e )
99
+ assert .Equal (t , "/group" , m )
100
+ _ , m = request (http .MethodGet , "/other" , e )
101
+ assert .Equal (t , "/*" , m )
102
+ _ , m = request (http .MethodGet , "/" , e )
103
+ assert .Equal (t , "/*" , m )
104
+
105
+ }
0 commit comments