We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
` package main
import ( "github.com/gin-gonic/gin" "net/http" )
type User struct { UserName *string form:"user_name" binding:"required" }
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()}) } } `
The text was updated successfully, but these errors were encountered:
Because release v1.2 not support BindQuery,you should get newest code.
Sorry, something went wrong.
Implement in #1336 . try it in the latest master branch.
No branches or pull requests
`
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()})
}
}
`
The text was updated successfully, but these errors were encountered: