MCPcopy Create free account
hub / github.com/ankorstore/yokai / ExtractMethods

Function ExtractMethods

fxhttpserver/method.go:32–50  ·  view source on GitHub ↗
(methods string)

Source from the content-addressed store, hash-verified

30}
31
32func ExtractMethods(methods string) ([]string, error) {
33 if methods == AllMethods {
34 return validMethods, nil
35 }
36
37 var extractedMethods []string
38
39 for _, method := range Split(methods) {
40 method = strings.ToUpper(method)
41
42 if Contains(validMethods, method) {
43 extractedMethods = append(extractedMethods, method)
44 } else {
45 return nil, fmt.Errorf("invalid HTTP method %q", method)
46 }
47 }
48
49 return extractedMethods, nil
50}

Callers 1

withRegisteredResourcesFunction · 0.85

Calls 3

SplitFunction · 0.70
ContainsFunction · 0.70
ErrorfMethod · 0.45

Tested by

no test coverage detected