xref: /unit/test/go/cookies/app.go (revision 1329:d4d7d2ca74b1)
1693Szelenkov@nginx.compackage main
2693Szelenkov@nginx.com
3693Szelenkov@nginx.comimport (
41120Szelenkov@nginx.com	"net/http"
5*1329Smax.romanov@nginx.com	"unit.nginx.org/go"
6693Szelenkov@nginx.com)
7693Szelenkov@nginx.com
8693Szelenkov@nginx.comfunc handler(w http.ResponseWriter, r *http.Request) {
91120Szelenkov@nginx.com	cookie1, _ := r.Cookie("var1")
101120Szelenkov@nginx.com	cookie2, _ := r.Cookie("var2")
11693Szelenkov@nginx.com
121120Szelenkov@nginx.com	w.Header().Set("X-Cookie-1", cookie1.Value)
131120Szelenkov@nginx.com	w.Header().Set("X-Cookie-2", cookie2.Value)
14693Szelenkov@nginx.com}
15693Szelenkov@nginx.com
16693Szelenkov@nginx.comfunc main() {
171120Szelenkov@nginx.com	http.HandleFunc("/", handler)
181120Szelenkov@nginx.com	unit.ListenAndServe(":7080", nil)
19693Szelenkov@nginx.com}
20