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
GetUint and GetUint64 wrong return #3927
Comments
There is a problem with your usage, you should use package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
g := gin.Default()
g.GET("/hello", func(c *gin.Context) {
m := make(map[string]string)
if err := c.BindQuery(&m); err != nil {
c.String(http.StatusInternalServerError,"input data have error: %v",err)
return
}
c.String(http.StatusOK,"input data: %v",m["user"])
})
g.Run(":9000")
} If you use package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
g := gin.Default()
g.GET("/hello", func(c *gin.Context) {
c.Set("user",999)
c.String(http.StatusOK,"user id: %d",c.GetInt("user"))
})
g.Run(":9000")
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I'm trying to use GetUint64 and GetUint but it returns 0
How to reproduce
Expectations
Actual result
Environment
The text was updated successfully, but these errors were encountered: