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

Method PostValueString

context/context.go:1964–1975  ·  view source on GitHub ↗

PostValueString same as `PostValue` method but it reports an error if the value with key equals to "name" does not exist.

(name string)

Source from the content-addressed store, hash-verified

1962// PostValueString same as `PostValue` method but it reports
1963// an error if the value with key equals to "name" does not exist.
1964func (ctx *Context) PostValueString(name string) (string, error) {
1965 values, err := ctx.PostValues(name)
1966 if err != nil {
1967 return "", err
1968 }
1969
1970 if len(values) == 0 { // just in case.
1971 return "", ErrEmptyForm
1972 }
1973
1974 return values[len(values)-1], nil
1975}
1976
1977// PostValue returns the last parsed form data from POST, PATCH,
1978// or PUT body parameters based on a "name".

Callers 15

PostValueUintMethod · 0.95
PostValueUint8Method · 0.95
PostValueUint16Method · 0.95
PostValueUint32Method · 0.95
PostValueUint64Method · 0.95
PostValueIntMethod · 0.95
PostValueInt8Method · 0.95
PostValueInt16Method · 0.95
PostValueInt32Method · 0.95
PostValueInt64Method · 0.95
PostValueFloat32Method · 0.95
PostValueFloat64Method · 0.95

Calls 1

PostValuesMethod · 0.95

Tested by

no test coverage detected