simplify call to peer
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user