| Lorenz Brun | 276a746 | 2023-07-12 21:28:54 +0200 | [diff] [blame] | 1 | // httpserver serves a test HTTP endpoint for E2E testing. |
| 2 | package main |
| 3 | |
| 4 | import ( |
| 5 | "net/http" |
| 6 | "os" |
| 7 | ) |
| 8 | |
| 9 | func main() { |
| 10 | nodeName := os.Getenv("NODE_NAME") |
| 11 | http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 12 | w.Header().Set("X-Node-Name", nodeName) |
| 13 | w.Header().Set("X-Remote-IP", r.RemoteAddr) |
| 14 | w.WriteHeader(http.StatusOK) |
| 15 | // Send a big chunk to root out MTU/MSS issues. |
| 16 | testPayload := make([]byte, 2000) |
| 17 | w.Write(testPayload) |
| 18 | })) |
| 19 | } |