(r *http.Request, key string, def int)
| 36 | } |
| 37 | |
| 38 | func getIntQueryParam(r *http.Request, key string, def int) (int, error) { |
| 39 | strVal := r.URL.Query().Get(key) |
| 40 | |
| 41 | if strVal == "" { |
| 42 | return def, nil |
| 43 | } |
| 44 | |
| 45 | if intVal, err := strconv.Atoi(strVal); err == nil { |
| 46 | return intVal, nil |
| 47 | } |
| 48 | |
| 49 | return 0, fmt.Errorf("invalid query parameter, \"%s\" must be an integer", key) |
| 50 | } |
| 51 | |
| 52 | func parseIdentifier(path, endpoint string) (string, error) { |
| 53 | return url.PathUnescape(strings.TrimPrefix(path, endpoint+"/")) |
no test coverage detected
searching dependent graphs…