xref: /unit/test/go/post_variables/app.go (revision 1329:d4d7d2ca74b1)
1package main
2
3import (
4	"net/http"
5	"unit.nginx.org/go"
6)
7
8func handler(w http.ResponseWriter, r *http.Request) {
9	r.ParseForm()
10
11	w.Header().Set("X-Var-1", r.Form.Get("var1"))
12	w.Header().Set("X-Var-2", r.Form.Get("var2"))
13	w.Header().Set("X-Var-3", r.Form.Get("var3"))
14}
15
16func main() {
17	http.HandleFunc("/", handler)
18	unit.ListenAndServe(":7080", nil)
19}
20