add godoc for #1533

Former-commit-id: face69d4018159e804c1461c8faf3e629a61b653
This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-06-09 10:20:21 +03:00
parent caa2545e3b
commit 350887d302
2 changed files with 11 additions and 1 deletions

View File

@ -667,9 +667,14 @@ type Context interface {
// is false (as defaulted) in this case the caller should check the pointer to
// see if something was actually binded.
//
// If a client sent an unknown field, this method will return an error,
// in order to ignore that error use the `err != nil && !iris.IsErrPath(err)`.
//
// Example: https://github.com/kataras/iris/blob/master/_examples/request-body/read-form/main.go
ReadForm(formObject interface{}) error
// ReadQuery binds url query to "ptr". The struct field tag is "url".
// If a client sent an unknown field, this method will return an error,
// in order to ignore that error use the `err != nil && !iris.IsErrPath(err)`.
//
// Example: https://github.com/kataras/iris/blob/master/_examples/request-body/read-query/main.go
ReadQuery(ptr interface{}) error
@ -2923,6 +2928,9 @@ var ErrEmptyForm = errors.New("empty form")
// is false (as defaulted) in this case the caller should check the pointer to
// see if something was actually binded.
//
// If a client sent an unknown field, this method will return an error,
// in order to ignore that error use the `err != nil && !iris.IsErrPath(err)`.
//
// Example: https://github.com/kataras/iris/blob/master/_examples/request-body/read-form/main.go
func (ctx *context) ReadForm(formObject interface{}) error {
values := ctx.FormValues()
@ -2942,6 +2950,8 @@ func (ctx *context) ReadForm(formObject interface{}) error {
}
// ReadQuery binds url query to "ptr". The struct field tag is "url".
// If a client sent an unknown field, this method will return an error,
// in order to ignore that error use the `err != nil && !iris.IsErrPath(err)`.
//
// Example: https://github.com/kataras/iris/blob/master/_examples/request-body/read-query/main.go
func (ctx *context) ReadQuery(ptr interface{}) error {

View File

@ -579,7 +579,7 @@ var (
// A shortcut for the `context#CookieEncoding`.
CookieEncoding = context.CookieEncoding
// IsErrPath can be used at `context#ReadForm`.
// IsErrPath can be used at `context#ReadForm` and `context#ReadQuery`.
// It reports whether the incoming error is type of `formbinder.ErrPath`,
// which can be ignored when server allows unknown post values to be sent by the client.
//