|
@@ -160,6 +160,7 @@ func (s *Server) handleFunc(path string, f func(http.ResponseWriter, *http.Reque
|
|
|
if err := f(w, req); err != nil {
|
|
if err := f(w, req); err != nil {
|
|
|
if etcdErr, ok := err.(*etcdErr.Error); ok {
|
|
if etcdErr, ok := err.(*etcdErr.Error); ok {
|
|
|
log.Debug("Return error: ", (*etcdErr).Error())
|
|
log.Debug("Return error: ", (*etcdErr).Error())
|
|
|
|
|
+ w.Header().Set("Content-Type", "application/json")
|
|
|
etcdErr.Write(w)
|
|
etcdErr.Write(w)
|
|
|
} else {
|
|
} else {
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
@@ -260,6 +261,7 @@ func (s *Server) Dispatch(c raft.Command, w http.ResponseWriter, req *http.Reque
|
|
|
e, _ := result.(*store.Event)
|
|
e, _ := result.(*store.Event)
|
|
|
b, _ = json.Marshal(e)
|
|
b, _ = json.Marshal(e)
|
|
|
|
|
|
|
|
|
|
+ w.Header().Set("Content-Type", "application/json")
|
|
|
// etcd index should be the same as the event index
|
|
// etcd index should be the same as the event index
|
|
|
// which is also the last modified index of the node
|
|
// which is also the last modified index of the node
|
|
|
w.Header().Add("X-Etcd-Index", fmt.Sprint(e.Index))
|
|
w.Header().Add("X-Etcd-Index", fmt.Sprint(e.Index))
|