summaryrefslogtreecommitdiff
path: root/hh.go
diff options
context:
space:
mode:
Diffstat (limited to 'hh.go')
-rw-r--r--hh.go14
1 files changed, 14 insertions, 0 deletions
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
+}