split by comma , param is required. when missing, panic error.
(request *http.Request, key string)
| 30 | |
| 31 | // split by comma , param is required. when missing, panic error. |
| 32 | func 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. |
| 46 | func ExtractRequestInt64(request *http.Request, key string) int64 { |