feat(server): add HEAD for v1/watch

This commit is contained in:
Yicheng Qin
2014-04-08 17:37:05 -07:00
parent 89d3df242c
commit 76ac1da7ea
2 changed files with 5 additions and 3 deletions

View File

@@ -32,9 +32,11 @@ func WatchKeyHandler(w http.ResponseWriter, req *http.Request, s Server) error {
event := <-watcher.EventChan
// Convert event to a response and write to client.
b, _ := json.Marshal(event.Response(s.Store().Index()))
w.WriteHeader(http.StatusOK)
if req.Method == "HEAD" {
return nil
}
b, _ := json.Marshal(event.Response(s.Store().Index()))
w.Write(b)
return nil
}