Validate returns nil or an error related to the [FormData] values, with a [SentinelHttpError] (status code 400, errors' details as a message) wrapped inside. var foo string err := ctx.FormData(). MandatoryString("foo", &foo, "bar"). Validate()
()
| 54 | // MandatoryString("foo", &foo, "bar"). |
| 55 | // Validate() |
| 56 | func (form *FormData) Validate() error { |
| 57 | if form.errors == nil { |
| 58 | return nil |
| 59 | } |
| 60 | |
| 61 | return WrapError( |
| 62 | form.errors, |
| 63 | NewSentinelHttpError(http.StatusBadRequest, fmt.Sprintf("Invalid form data: %s", form.errors)), |
| 64 | ) |
| 65 | } |
| 66 | |
| 67 | // String binds a form field to a string variable. |
| 68 | // |
nothing calls this directly
no test coverage detected