From 350887d302ad668a8b847063a25e3a83451146aa Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Tue, 9 Jun 2020 10:20:21 +0300 Subject: [PATCH] add godoc for #1533 Former-commit-id: face69d4018159e804c1461c8faf3e629a61b653 --- context/context.go | 10 ++++++++++ iris.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/context/context.go b/context/context.go index 73e9f029..146bc1e1 100644 --- a/context/context.go +++ b/context/context.go @@ -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 { diff --git a/iris.go b/iris.go index 827c3773..33f1ac82 100644 --- a/iris.go +++ b/iris.go @@ -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. //