docs: update

This commit is contained in:
nlwkobe30 2023-01-05 01:59:18 +08:00
parent a14466232b
commit 82716193b7
1 changed files with 6 additions and 8 deletions

View File

@ -2108,15 +2108,13 @@ func main() {
router := gin.Default() router := gin.Default()
router.GET("/cookie", func(c *gin.Context) { router.GET("/cookie", func(c *gin.Context) {
cookie, err := c.Cookie("gin_cookie")
if err != nil {
cookie = "NotSet"
c.SetCookie("gin_cookie", "test", 3600, "/", "localhost", false, true)
}
cookie, err := c.Cookie("gin_cookie") fmt.Printf("Cookie value: %s \n", cookie)
if err != nil {
cookie = "NotSet"
c.SetCookie("gin_cookie", "test", 3600, "/", "localhost", false, true)
}
fmt.Printf("Cookie value: %s \n", cookie)
}) })
router.Run() router.Run()