echo: Regression: binding a map is not allowed anymore
Issue Description
I think a valid use case of binding to a map[string]interface{}
now causes the following error: Binding element must be a struct
. I think the regression has been caused by #972.
Is this use case still valid ?
Checklist
- Dependencies installed
- No typos
- Searched existing issues and docs
Expected behaviour
Binding a map[string]interface{}
is valid.
Actual behaviour
Binding a map[string]interface{}
causes an error.
Code to debug
package main
func handler(c echo.Context) {
var m map[string]interface{}
if err := c.Bind(&m); err != nil {
// err is "Binding element must be a struct"
}
return nil
}
Version/commit
1e9845a414f5177986779ee21963df7d1e362e15
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 20 (6 by maintainers)
Commits related to this issue
- Fixed #988 Signed-off-by: Vishal Rana <vr@labstack.com> — committed to labstack/echo by deleted user 5 years ago
- Nil check for bind #988 Signed-off-by: Vishal Rana <vr@labstack.com> — committed to labstack/echo by deleted user 5 years ago
@nono I will look into this today.
Has this issue been solved? I meet it today. my code as following:
maybe you need to repear it locally since go playground cannot listen port. @vishr