Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BindQuery not support pointer #1190

Closed
Jiachang-Cai opened this issue Dec 5, 2017 · 2 comments
Closed

BindQuery not support pointer #1190

Jiachang-Cai opened this issue Dec 5, 2017 · 2 comments

Comments

@Jiachang-Cai
Copy link

`
package main

import (
"github.com/gin-gonic/gin"
"net/http"
)

type User struct {
UserName *string form:"user_name" binding:"required"
}

func main() {
r := gin.Default()
r.GET("/user", getUser)
r.Run(":8085")
}

func getUser(c *gin.Context) {
var user User
if err := c.BindQuery(&user); err == nil {
c.JSON(http.StatusOK, gin.H{"message": "valid!"})
} else {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
}
}
`

@ziyoumeng
Copy link

Because release v1.2 not support BindQuery,you should get newest code.

@thinkerou
Copy link
Member

Implement in #1336 . try it in the latest master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants