1 package main 2 3 import ( 4 "net/http" 5 "os" 6 7 //nolint:depguard // Because of the simple Dockerfile, we are limited to stdlib. 8 "log" 9 ) 10 11 func main() { 12 body := os.Getenv("HTTPTEST_BODY") 13 if body == "" { 14 body = "HTTPTEST" 15 } 16 17 mux := http.NewServeMux() 18 mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { 19 _, err := w.Write([]byte(body)) 20 if err != nil { 21 log.Print(err) 22 } 23 }) 24 25 log.Fatal(http.ListenAndServe(":8080", mux)) 26 } 27