Files
nginx-unit/test/go/command_line_arguments/app.go
Max Romanov 693a458b4e Go: changing import name for "unit.nginx.org/go".
This patch includes packaging changes - update unit-go installation
directory.
2019-12-25 20:00:32 +03:00

24 lines
417 B
Go

package main
import (
"fmt"
"io"
"net/http"
"unit.nginx.org/go"
"os"
"strings"
)
func handler(w http.ResponseWriter, r *http.Request) {
args := strings.Join(os.Args[1:], ",")
w.Header().Add("X-Arg-0", fmt.Sprintf("%v", os.Args[0]))
w.Header().Add("Content-Length", fmt.Sprintf("%v", len(args)))
io.WriteString(w, args)
}
func main() {
http.HandleFunc("/", handler)
unit.ListenAndServe(":7080", nil)
}