本文整理汇总了Golang中camlistore/org/pkg/httputil.InvalidParameterError函数的典型用法代码示例。如果您正苦于以下问题:Golang InvalidParameterError函数的具体用法?Golang InvalidParameterError怎么用?Golang InvalidParameterError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InvalidParameterError函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: fromHTTP
// fromHTTP panics with an httputil value on failure
func (r *WithAttrRequest) fromHTTP(req *http.Request) {
r.Signer = blob.ParseOrZero(req.FormValue("signer"))
r.Value = req.FormValue("value")
fuzzy := req.FormValue("fuzzy") // exact match if empty
fuzzyMatch := false
if fuzzy != "" {
lowered := strings.ToLower(fuzzy)
if lowered == "true" || lowered == "t" {
fuzzyMatch = true
}
}
r.Attr = req.FormValue("attr") // all attributes if empty
if r.Attr == "" { // and force fuzzy in that case.
fuzzyMatch = true
}
r.Fuzzy = fuzzyMatch
r.ThumbnailSize = thumbnailSize(req)
max := req.FormValue("max")
if max != "" {
maxR, err := strconv.Atoi(max)
if err != nil {
panic(httputil.InvalidParameterError("max"))
}
r.N = maxR
}
r.N = r.n()
}
示例2: fromHTTP
// fromHTTP panics with an httputil value on failure
func (r *WithAttrRequest) fromHTTP(req *http.Request) {
r.Signer = httputil.MustGetBlobRef(req, "signer")
r.Value = req.FormValue("value")
fuzzy := req.FormValue("fuzzy") // exact match if empty
fuzzyMatch := false
if fuzzy != "" {
lowered := strings.ToLower(fuzzy)
if lowered == "true" || lowered == "t" {
fuzzyMatch = true
}
}
r.Attr = req.FormValue("attr") // all attributes if empty
if r.Attr == "" { // and force fuzzy in that case.
fuzzyMatch = true
}
r.Fuzzy = fuzzyMatch
maxResults := maxPermanodes
max := req.FormValue("max")
if max != "" {
maxR, err := strconv.Atoi(max)
if err != nil {
panic(httputil.InvalidParameterError("max"))
}
if maxR < maxResults {
maxResults = maxR
}
}
r.N = maxResults
}
示例3: fromHTTP
// fromHTTP panics with an httputil value on failure
func (r *DescribeRequest) fromHTTP(req *http.Request) {
req.ParseForm()
if vv := req.Form["blobref"]; len(vv) > 1 {
for _, brs := range vv {
if br, ok := blob.Parse(brs); ok {
r.BlobRefs = append(r.BlobRefs, br)
} else {
panic(httputil.InvalidParameterError("blobref"))
}
}
} else {
r.BlobRef = httputil.MustGetBlobRef(req, "blobref")
}
r.Depth = httputil.OptionalInt(req, "depth")
}
示例4: fromHTTPGet
func (r *DescribeRequest) fromHTTPGet(req *http.Request) {
req.ParseForm()
if vv := req.Form["blobref"]; len(vv) > 1 {
for _, brs := range vv {
if br, ok := blob.Parse(brs); ok {
r.BlobRefs = append(r.BlobRefs, br)
} else {
panic(httputil.InvalidParameterError("blobref"))
}
}
} else {
r.BlobRef = httputil.MustGetBlobRef(req, "blobref")
}
r.Depth = httputil.OptionalInt(req, "depth")
r.MaxDirChildren = httputil.OptionalInt(req, "maxdirchildren")
r.At = types.ParseTime3339OrZero(req.FormValue("at"))
}