@@ -101,7 +101,7 @@ func (r *Route) wrapMiddlewareAndHandler(h []any) ([]func(http.Handler) http.Han
101101 return middlewares , handlerFunc
102102}
103103
104- func (r * Route ) Methods (method , pattern string , h [] any ) {
104+ func (r * Route ) Methods (method , pattern string , h ... any ) {
105105 middlewares , handlerFunc := r .wrapMiddlewareAndHandler (h )
106106 fullPattern := r .getPattern (pattern )
107107 if strings .Contains (method , "," ) {
@@ -126,49 +126,44 @@ func (r *Route) Any(pattern string, h ...any) {
126126 r .R .With (middlewares ... ).HandleFunc (r .getPattern (pattern ), handlerFunc )
127127}
128128
129- // RouteMethods delegate special methods, it is an alias of "Methods", while the "pattern" is the first parameter
130- func (r * Route ) RouteMethods (pattern , methods string , h ... any ) {
131- r .Methods (methods , pattern , h )
132- }
133-
134129// Delete delegate delete method
135130func (r * Route ) Delete (pattern string , h ... any ) {
136- r .Methods ("DELETE" , pattern , h )
131+ r .Methods ("DELETE" , pattern , h ... )
137132}
138133
139134// Get delegate get method
140135func (r * Route ) Get (pattern string , h ... any ) {
141- r .Methods ("GET" , pattern , h )
136+ r .Methods ("GET" , pattern , h ... )
142137}
143138
144139// GetOptions delegate get and options method
145140func (r * Route ) GetOptions (pattern string , h ... any ) {
146- r .Methods ("GET,OPTIONS" , pattern , h )
141+ r .Methods ("GET,OPTIONS" , pattern , h ... )
147142}
148143
149144// PostOptions delegate post and options method
150145func (r * Route ) PostOptions (pattern string , h ... any ) {
151- r .Methods ("POST,OPTIONS" , pattern , h )
146+ r .Methods ("POST,OPTIONS" , pattern , h ... )
152147}
153148
154149// Head delegate head method
155150func (r * Route ) Head (pattern string , h ... any ) {
156- r .Methods ("HEAD" , pattern , h )
151+ r .Methods ("HEAD" , pattern , h ... )
157152}
158153
159154// Post delegate post method
160155func (r * Route ) Post (pattern string , h ... any ) {
161- r .Methods ("POST" , pattern , h )
156+ r .Methods ("POST" , pattern , h ... )
162157}
163158
164159// Put delegate put method
165160func (r * Route ) Put (pattern string , h ... any ) {
166- r .Methods ("PUT" , pattern , h )
161+ r .Methods ("PUT" , pattern , h ... )
167162}
168163
169164// Patch delegate patch method
170165func (r * Route ) Patch (pattern string , h ... any ) {
171- r .Methods ("PATCH" , pattern , h )
166+ r .Methods ("PATCH" , pattern , h ... )
172167}
173168
174169// ServeHTTP implements http.Handler
0 commit comments