(w http.ResponseWriter, r *http.Request)
| 156 | } |
| 157 | |
| 158 | func serveHome(w http.ResponseWriter, r *http.Request) { |
| 159 | if r.URL.Path != "/" { |
| 160 | http.Error(w, "Not found.", http.StatusNotFound) |
| 161 | return |
| 162 | } |
| 163 | if r.Method != http.MethodGet { |
| 164 | http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) |
| 165 | return |
| 166 | } |
| 167 | w.Header().Set("Content-Type", "text/html; charset=utf-8") |
| 168 | io.WriteString(w, "<html><body>Echo Server</body></html>") |
| 169 | } |
| 170 | |
| 171 | var addr = flag.String("addr", ":9000", "http service address") |
| 172 |
nothing calls this directly
no test coverage detected