-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/ / / / / / / / / / / / / / / / / /
Please use forum https://forum.labstack.com to ask questions!
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/ / / / / / / / / / / / / / / / / /
Issue Description
When I use the Context#Bind method of the Context#DefaultBinder (default implementation for the Context#Binder interface), I cannot bind the parameters contained in the url/path of the request.
Checklist
- Dependencies installed
- No typos
- Searched existing issues and docs
Expected behavior
Code for the handler (derived from the examples in the documentation):
e.GET("/users/:name", func(c echo.Context) error {
u := new(User)
if err = c.Bind(u); err != nil {
return
}
return c.JSON(http.StatusOK, u)
})Code defining user type, also taken from the examples in the documentation
// User
type User struct {
Name string `json:"name" form:"name" url:"name"`
Email string `json:"email" form:"email" query:"email"`
}If I run the following request:
curl -XGET http://localhost:1323/users/Joe\?email\=joe_emailI would expect the Name field in u to be equal to "Joe".
Actual behavior
When executing the following request:
curl -XGET http://localhost:1323/users/Joe\?email\=joe_emailThe Name field in u remains empty.
Steps to reproduce
Working code to debug
Version/commit
phymbert, gscout, BoeingX, sungjunyoung, reyhansofian and 2 more