mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
21 lines
396 B
Go
21 lines
396 B
Go
|
package server
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
"strconv"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func boolValue(r *http.Request, k string) bool {
|
||
|
s := strings.ToLower(strings.TrimSpace(r.FormValue(k)))
|
||
|
return !(s == "" || s == "0" || s == "no" || s == "false" || s == "none")
|
||
|
}
|
||
|
|
||
|
func int64Value(r *http.Request, k string) int64 {
|
||
|
val, err := strconv.ParseInt(r.FormValue(k), 10, 64)
|
||
|
if err != nil {
|
||
|
return 0
|
||
|
}
|
||
|
return val
|
||
|
}
|