From 14db9705ae1c2a10bb5e62a66a72f5cbc7aa7b13 Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Fri, 15 Nov 2024 12:14:28 +0100 Subject: Add some unfinished work in progress code --- hh.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 hh.go (limited to 'hh.go') diff --git a/hh.go b/hh.go new file mode 100644 index 0000000..e6593ed --- /dev/null +++ b/hh.go @@ -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 +} -- cgit v1.2.3