MCPcopy Create free account
hub / github.com/kataras/iris / FormValueDefault

Method FormValueDefault

context/context.go:1769–1776  ·  view source on GitHub ↗

No need anymore, net/http checks for the Form already. func (ctx *Context) askParseForm() error { if ctx.request.Form == nil { if err := ctx.request.ParseForm(); err != nil { return err } } return nil } FormValueDefault returns a single parsed form value by its "name", including both the U

(name string, def string)

Source from the content-addressed store, hash-verified

1767//
1768// Returns the "def" if not found.
1769func (ctx *Context) FormValueDefault(name string, def string) string {
1770 if form, has := ctx.form(); has {
1771 if v := form[name]; len(v) > 0 {
1772 return v[0]
1773 }
1774 }
1775 return def
1776}
1777
1778// FormValueDefault retruns a single parsed form value.
1779func FormValueDefault(r *http.Request, name string, def string, postMaxMemory int64, resetBody bool) string {

Callers 1

FormValueMethod · 0.95

Calls 1

formMethod · 0.95

Tested by

no test coverage detected