diff options
Diffstat (limited to 'test/go/command_line_arguments')
-rw-r--r-- | test/go/command_line_arguments/app.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/go/command_line_arguments/app.go b/test/go/command_line_arguments/app.go new file mode 100644 index 00000000..228e07c0 --- /dev/null +++ b/test/go/command_line_arguments/app.go @@ -0,0 +1,23 @@ +package main + +import ( + "io" + "os" + "fmt" + "strings" + "net/http" + "nginx/unit" +) + +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) +} |