simplify call to peer

This commit is contained in:
mr
2024-08-23 09:53:37 +02:00
parent 29c2ab0e4c
commit e8acf8a127
6 changed files with 98 additions and 124 deletions

View File

@@ -16,6 +16,23 @@ const (
DELETE
)
func (m METHOD) String() string {
return [...]string{"GET", "PUT", "POST", "DELETE"}[m]
}
func (m METHOD) EnumIndex() int {
return int(m)
}
func ToMethod(str string) METHOD {
for _, s := range []METHOD{GET, PUT, POST, DELETE} {
if s.String() == str {
return s
}
}
return GET
}
var HTTPCallerInstance = &HTTPCaller{}
type HTTPCaller struct {