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)
| 1767 | // |
| 1768 | // Returns the "def" if not found. |
| 1769 | func (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. |
| 1779 | func FormValueDefault(r *http.Request, name string, def string, postMaxMemory int64, resetBody bool) string { |