diff --git a/tstest/integration/testcontrol/testcontrol.go b/tstest/integration/testcontrol/testcontrol.go index 4683cbc0b..434b6a311 100644 --- a/tstest/integration/testcontrol/testcontrol.go +++ b/tstest/integration/testcontrol/testcontrol.go @@ -99,6 +99,7 @@ func (s *Server) initMux() { s.mux.HandleFunc("/", s.serveUnhandled) s.mux.HandleFunc("/key", s.serveKey) s.mux.HandleFunc("/machine/", s.serveMachine) + s.mux.HandleFunc("/ping", s.servePingInfo) } func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { @@ -172,6 +173,19 @@ func (s *Server) serveMachine(w http.ResponseWriter, r *http.Request) { } } +// servePingInfo currently placeholder, determine the correct response to client +func (s *Server) servePingInfo(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + if r.Method != "PUT" { + http.Error(w, "Only PUT requests are supported currently", http.StatusMethodNotAllowed) + } + _, err := ioutil.ReadAll(r.Body) + defer r.Body.Close() + if err != nil { + http.Error(w, "Failed to read request body", http.StatusInternalServerError) + } +} + // Node returns the node for nodeKey. It's always nil or cloned memory. func (s *Server) Node(nodeKey tailcfg.NodeKey) *tailcfg.Node { s.mu.Lock()