summaryrefslogtreecommitdiff
path: root/hh.go
blob: e6593ed1f272b96c19871df7bdf4dfe490faf378 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
}