MCPcopy
hub / github.com/gorilla/websocket / serveHome

Function serveHome

examples/autobahn/server.go:158–169  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

156}
157
158func 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
171var addr = flag.String("addr", ":9000", "http service address")
172

Callers

nothing calls this directly

Calls 2

WriteStringMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected