summaryrefslogblamecommitdiffhomepage
path: root/test/go/cookies/app.go
blob: e6647ea8ca8afd0f56a256b1fd52559614942f6f (plain) (tree)
1
2
3
4
5
6
7
8
9
10


            

                    


                                                      

                                      
 

                                                   


             

                                         
 
package main

import (
	"net/http"
	"nginx/unit"
)

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(":7080", nil)
}