MCPcopy
hub / github.com/eyebluecn/tank / ExtractRequestArray

Function ExtractRequestArray

code/tool/util/util_params.go:32–43  ·  view source on GitHub ↗

split by comma , param is required. when missing, panic error.

(request *http.Request, key string)

Source from the content-addressed store, hash-verified

30
31// split by comma , param is required. when missing, panic error.
32func ExtractRequestArray(request *http.Request, key string) []string {
33 str := request.FormValue(key)
34 if str == "" {
35 panic(fmt.Sprintf("%s is required", key))
36 } else {
37 arr := strings.Split(str, ",")
38 if len(arr) == 0 {
39 panic(fmt.Sprintf("%s cannot be empty", key))
40 }
41 return arr
42 }
43}
44
45// param is required. when missing, panic error.
46func ExtractRequestInt64(request *http.Request, key string) int64 {

Callers 1

CreateMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected