This commit is contained in:
mr 2024-10-22 14:23:39 +02:00
parent 72d5c64c2d
commit 719fa239e0

View File

@ -15,11 +15,16 @@ const (
PUT PUT
POST POST
DELETE DELETE
STRICT_INTERNAL_GET
STRICT_INTERNAL_PUT
STRICT_INTERNAL_POST
STRICT_INTERNAL_DELETE
) )
// String returns the string of the enum // String returns the string of the enum
func (m METHOD) String() string { func (m METHOD) String() string {
return [...]string{"GET", "PUT", "POST", "DELETE"}[m] return [...]string{"GET", "PUT", "POST", "DELETE", "INTERNALGET", "INTERNALPUT", "INTERNALPOST", "INTERNALDELETE"}[m]
} }
// EnumIndex returns the index of the enum // EnumIndex returns the index of the enum
@ -29,7 +34,8 @@ func (m METHOD) EnumIndex() int {
// ToMethod returns the method from a string // ToMethod returns the method from a string
func ToMethod(str string) METHOD { func ToMethod(str string) METHOD {
for _, s := range []METHOD{GET, PUT, POST, DELETE} { for _, s := range []METHOD{GET, PUT, POST, DELETE,
STRICT_INTERNAL_GET, STRICT_INTERNAL_PUT, STRICT_INTERNAL_POST, STRICT_INTERNAL_DELETE} {
if s.String() == str { if s.String() == str {
return s return s
} }