diff options
author | Mathias Magnusson <mathias@magnusson.space> | 2024-11-15 12:14:28 +0100 |
---|---|---|
committer | Mathias Magnusson <mathias@magnusson.space> | 2024-11-15 12:14:28 +0100 |
commit | 14db9705ae1c2a10bb5e62a66a72f5cbc7aa7b13 (patch) | |
tree | ce40cde93704fcd6c811a7d70b518ae522f342ea /hh.go | |
parent | aed837bec26d2855096b33bb249ddac36a10ad8f (diff) | |
download | hh-14db9705ae1c2a10bb5e62a66a72f5cbc7aa7b13.tar.gz |
Add some unfinished work in progress code
Diffstat (limited to 'hh.go')
-rw-r--r-- | hh.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -0,0 +1,14 @@ +package hh + +import ( + "errors" + "net/http" +) + +func Cookie(r http.Request, name string) (string, error) { + cookie, _ := r.Cookie(name) + if cookie == nil { + return "", errors.New("Bad request: missing cookie " + name) + } + return cookie.Value, nil +} |