imported cookies module
This commit is contained in:
23
cookies/set.go
Normal file
23
cookies/set.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package cookies
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Set a cookie with the given name, path and value. maxAge directly relates
|
||||
// to cookie MaxAge (0 for no max age, >0 for TTL in seconds)
|
||||
func SetCookie(
|
||||
w http.ResponseWriter,
|
||||
name string,
|
||||
path string,
|
||||
value string,
|
||||
maxAge int,
|
||||
) {
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
Name: name,
|
||||
Value: value,
|
||||
Path: path,
|
||||
HttpOnly: true,
|
||||
MaxAge: maxAge,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user