MCPcopy Create free account
hub / github.com/elimity-com/scim / getIntQueryParam

Function getIntQueryParam

server.go:38–50  ·  view source on GitHub ↗
(r *http.Request, key string, def int)

Source from the content-addressed store, hash-verified

36}
37
38func 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
52func parseIdentifier(path, endpoint string) (string, error) {
53 return url.PathUnescape(strings.TrimPrefix(path, endpoint+"/"))

Callers 1

parseRequestParamsMethod · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…