cookie

package
v0.7.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 2 Imported by: 0

README

Cookie helper functions.

package main

import (
	"net/http"
	
	"github.com/infiniteloopcloud/cookie"
)

func main() {
	// Set the cookie's domain options
	cookie.SetDomain(".test.com")
	// Set the cookie's secure option
	cookie.SetSecure(true)

	// Let's say this is the response
	var w http.ResponseWriter

	// Set a NOT HTTP ONLY value
 	cookie.Set(w, "jwt", "test")
	// Delete that cookie
	cookie.Delete(w, "jwt")

	// Set a HTTP ONLY value
	cookie.SetHTTPOnly(w, "jwt", "test_http_only")
	// Delete that cookie
	cookie.DeleteHTTPOnly(w, "jwt")
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL