.Maui Blog

Golang – Get Cookies in Revel

package controllers

import (
    "github.com/revel/revel"
    "fmt"
    )
type App struct {
	*revel.Controller
}

func MyController(c App ) *Utente {
    cookies := c.Request.Cookies()

    for _, cookie := range cookies {
        if cookie.Name == "mycookie" {
            cookieValue := cookie.Value 
            fmt.Println(cookieValue )	
        }
    }
}
Exit mobile version