MCPcopy
hub / github.com/labstack/echo / FormValueOr

Method FormValueOr

context.go:403–409  ·  view source on GitHub ↗

FormValueOr returns the form field value or default value for the provided name. Note: FormValueOr does not distinguish if form had no value by that name or value was empty string

(name, defaultValue string)

Source from the content-addressed store, hash-verified

401// FormValueOr returns the form field value or default value for the provided name.
402// Note: FormValueOr does not distinguish if form had no value by that name or value was empty string
403func (c *Context) FormValueOr(name, defaultValue string) string {
404 value := c.FormValue(name)
405 if value == "" {
406 value = defaultValue
407 }
408 return value
409}
410
411// FormValues returns the form field values as `url.Values`.
412func (c *Context) FormValues() (url.Values, error) {

Callers 1

TestContextFormValueFunction · 0.95

Calls 1

FormValueMethod · 0.95

Tested by 1

TestContextFormValueFunction · 0.76