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

Method PostValueDefault

context/context.go:1953–1960  ·  view source on GitHub ↗

PostValueDefault returns the last parsed form data from POST, PATCH, or PUT body parameters based on a "name". If not found then "def" is returned instead.

(name string, def string)

Source from the content-addressed store, hash-verified

1951//
1952// If not found then "def" is returned instead.
1953func (ctx *Context) PostValueDefault(name string, def string) string {
1954 values, err := ctx.PostValues(name)
1955 if err != nil || len(values) == 0 {
1956 return def // it returns "def" even if it's empty here.
1957 }
1958
1959 return values[len(values)-1]
1960}
1961
1962// PostValueString same as `PostValue` method but it reports
1963// an error if the value with key equals to "name" does not exist.

Callers 3

PostValueMethod · 0.95
mainFunction · 0.80
newAppFunction · 0.80

Calls 1

PostValuesMethod · 0.95

Tested by

no test coverage detected