github.com/squaremo/docker@v1.3.2-0.20150516120342-42cfc9554972/api/server/form.go (about) 1 package server 2 3 import ( 4 "net/http" 5 "strconv" 6 "strings" 7 ) 8 9 func boolValue(r *http.Request, k string) bool { 10 s := strings.ToLower(strings.TrimSpace(r.FormValue(k))) 11 return !(s == "" || s == "0" || s == "no" || s == "false" || s == "none") 12 } 13 14 func int64ValueOrZero(r *http.Request, k string) int64 { 15 val, err := strconv.ParseInt(r.FormValue(k), 10, 64) 16 if err != nil { 17 return 0 18 } 19 return val 20 }