Skip to content

Commit 0329479

Browse files
committed
update method return type
1 parent cc09090 commit 0329479

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

types.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -678,26 +678,27 @@ type Resource struct {
678678
Nested map[string]*Resource `yaml:",regexp:/.*"`
679679
}
680680

681-
func (r *Resource) Methods() map[string]*Method {
682-
methods := make(map[string]*Method)
681+
func (r *Resource) Methods() []*Method {
682+
methods := make([]*Method, 1, 6)
683683
if r.Get != nil {
684-
methods["GET"] = r.Get
684+
methods = append(methods, r.Get)
685685
}
686686
if r.Post != nil {
687-
methods["POST"] = r.Post
687+
methods = append(methods, r.Post)
688688
}
689689
if r.Put != nil {
690-
methods["PUT"] = r.Put
690+
methods = append(methods, r.Put)
691691
}
692692
if r.Patch != nil {
693-
methods["PATCH"] = r.Patch
693+
methods = append(methods, r.Patch)
694694
}
695695
if r.Head != nil {
696-
methods["HEAD"] = r.Head
696+
methods = append(methods, r.Head)
697697
}
698698
if r.Delete != nil {
699-
methods["DELETE"] = r.Delete
699+
methods = append(methods, r.Delete)
700700
}
701+
701702
return methods
702703
}
703704

0 commit comments

Comments
 (0)