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 )	
        }
    }
}

Leave a Comment

Your email address will not be published. Required fields are marked *