param is required. when missing, panic error.
(request *http.Request, key string)
| 10 | |
| 11 | // param is required. when missing, panic error. |
| 12 | func ExtractRequestString(request *http.Request, key string) string { |
| 13 | str := request.FormValue(key) |
| 14 | if str == "" { |
| 15 | panic(fmt.Sprintf("%s is required", key)) |
| 16 | } else { |
| 17 | return str |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | // param is required. when missing, panic error. |
| 22 | func ExtractRequestStringWithErrorHint(request *http.Request, key string, errorHint string) string { |
no outgoing calls
no test coverage detected