Пример #1
0
func parseId(req *http.Request, key string) (uint32, error) {
	value, err := strconv.ParseUint(mux.Vars(req)[key], 10, 32)
	if err != nil || value == 0 {
		return 0, errors.New("Bad " + key)
	}
	return uint32(value), nil
}
Пример #2
0
func fillValues(req *http.Request) {
	req.ParseForm()
	for k, v := range mux.Vars(req) {
		req.Form.Add(k, v)
	}
}