summaryrefslogtreecommitdiffhomepage
path: root/test/go/cookies/app.go
blob: 49779d35555b2d1a7a61cf5236c1246bd860bf73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main

import (
	"net/http"
	"unit.nginx.org/go"
)

func handler(w http.ResponseWriter, r *http.Request) {
	cookie1, _ := r.Cookie("var1")
	cookie2, _ := r.Cookie("var2")

	w.Header().Set("X-Cookie-1", cookie1.Value)
	w.Header().Set("X-Cookie-2", cookie2.Value)
}

func main() {
	http.HandleFunc("/", handler)
	unit.ListenAndServe(":8080", nil)
}