(methods string)
| 30 | } |
| 31 | |
| 32 | func 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 | } |
no test coverage detected