🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

github.com/kemalerhalim/cookieservice

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/kemalerhalim/cookieservice

v0.0.0-20170727104143-77f07d62d9c3
Source
Go
Version published
Created
Source

cookieservice.go

Simple cookie service made for golang.

Installation

First, get the package

go get github.com/kemalerhalim/cookieservice

Then import it

import(
    "github.com/kemalerhalim/cookieservice"
)

Usage

  • Getting value of a cookie:
        func HomePage(w http.ResponseWriter,req *http.Request){
            var value=cookieservice.ReadCookie(req,"cookieName")
            fmt.Println(value)
            ...
        }
  • Creating a cookie (Which will expire after 48 hours):
        func HomePage(w http.ResponseWriter,req *http.Request){
            cookieservice.NewCookie(w,"cookieName","cookieValue",48)
            ...
        }
  • Deleting a cookie:
        func HomePage(w http.ResponseWriter,r *http.Request){
            cookieservice.DeleteCookie(w,"cookieName")
            ...
        }

FAQs

Package last updated on 27 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts