@@ -47,6 +47,13 @@ type (
47
47
// Version of Kid.
48
48
const Version string = "0.1.0"
49
49
50
+ // allMethods is all of the HTTP methods.
51
+ var allMethods = []string {
52
+ http .MethodGet , http .MethodPost , http .MethodPut ,
53
+ http .MethodPatch , http .MethodDelete , http .MethodHead ,
54
+ http .MethodOptions , http .MethodConnect , http .MethodTrace ,
55
+ }
56
+
50
57
// New returns a new instance of Kid.
51
58
func New () * Kid {
52
59
kid := Kid {
@@ -155,12 +162,7 @@ func (k *Kid) Trace(path string, handler HandlerFunc, middlewares ...MiddlewareF
155
162
//
156
163
// Specifying middlewares is optional. Middlewares will only be applied to this route.
157
164
func (k * Kid ) Any (path string , handler HandlerFunc , middlewares ... MiddlewareFunc ) {
158
- methods := []string {
159
- http .MethodGet , http .MethodPost , http .MethodPut ,
160
- http .MethodPatch , http .MethodDelete , http .MethodHead ,
161
- http .MethodOptions , http .MethodConnect , http .MethodTrace ,
162
- }
163
- k .router .add (path , handler , methods , middlewares )
165
+ k .router .add (path , handler , allMethods , middlewares )
164
166
}
165
167
166
168
// Group creates a new router group.
0 commit comments