In MVC mode, no matter get or post request, if the url or form parameter is not passed, no error will be triggered
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
@kataras
same question,In MVC mode, no matter get or post request, if the url or form parameter is not passed, no error will be triggered。
```go
app := iris.New()
app.Validator = validator.New()
// MVC
func (c *ApiController) GetFinanceTest(p struct {
PayIds string `url:"pay_ids" validate:"required"`
AccId int `url:"acc_id" validate:"required,min=1"`
}) {
// If an error occurs normally, it should not be executed here, but it passed
fmt.Println(p.AccId) // = 0
}
// _ = app.Listen(":8080")
app.Listen(":8080", iris.WithEmptyFormError) // ?
```
_Originally posted by @hjzCy in https://github.com/kataras/iris/issues/1625#issuecomment-816372692_
Contributor guide
Research direction
Reproduce the reported behavior with the ApiController.GetFinanceTest example and both GET and POST requests missing the required parameters. Start by tracing MVC parameter binding and validation from the controller entry point; done means missing required URL or form parameters trigger an error and the handler is not executed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100