xref: /unit/test/go/mirror/app.go (revision 1329:d4d7d2ca74b1)
1package main
2
3import (
4	"fmt"
5	"io"
6	"net/http"
7	"unit.nginx.org/go"
8)
9
10func handler(w http.ResponseWriter, r *http.Request) {
11	var buf [32768]byte
12	len, _ := r.Body.Read(buf[:])
13
14	w.Header().Add("Content-Length", fmt.Sprintf("%v", len))
15	io.WriteString(w, string(buf[:len]))
16}
17
18func main() {
19	http.HandleFunc("/", handler)
20	unit.ListenAndServe(":7080", nil)
21}
22