refactor(servers): emit http.Handlers from *Server

This commit is contained in:
Brian Waldon
2014-01-21 08:08:20 -08:00
parent 089021ca6d
commit 2fe22f1890
4 changed files with 6 additions and 19 deletions

View File

@ -45,8 +45,6 @@ func New(name, url string, peerServer *PeerServer, registry *Registry, store sto
metrics: mb,
}
s.handler = s.buildHTTPHandler()
return s
}
@ -169,7 +167,7 @@ func (s *Server) handleFunc(r *mux.Router, path string, f func(http.ResponseWrit
})
}
func (s *Server) buildHTTPHandler() http.Handler {
func (s *Server) HTTPHandler() http.Handler {
router := mux.NewRouter()
// Install the routes.
@ -185,10 +183,6 @@ func (s *Server) buildHTTPHandler() http.Handler {
return router
}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.handler.ServeHTTP(w, r)
}
// Dispatch command to the current leader
func (s *Server) Dispatch(c raft.Command, w http.ResponseWriter, req *http.Request) error {
ps := s.peerServer