Skip to content

Instantly share code, notes, and snippets.

@farhany
Created March 2, 2018 03:14
Show Gist options
  • Save farhany/0dfda5c655d46afa66db1cb3d0235cea to your computer and use it in GitHub Desktop.
Save farhany/0dfda5c655d46afa66db1cb3d0235cea to your computer and use it in GitHub Desktop.
golang - read cookie
func ReadCookie(w http.ResponseWriter, req *http.Request) {
// read cookie
var cookie, err = req.Cookie("cookie")
if err == nil {
var cookieValue = cookie.Value
log.Printf("Cookie is %s\n", cookieValue)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment