refactor(servers): emit http.Handlers from *Server
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user