fix bug that http server should return when handler is nil

Signed-off-by: Sun Hongliang <allen.sun@daocloud.io>
This commit is contained in:
Sun Hongliang
2016-05-10 17:02:11 +08:00
parent 34e3da3acd
commit 4ed5f96ea5

View File

@@ -28,6 +28,7 @@ func (d *dispatcher) SetHandler(handler http.Handler) {
func (d *dispatcher) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if d.handler == nil {
httpError(w, "No dispatcher defined", http.StatusInternalServerError)
return
}
d.handler.ServeHTTP(w, r)
}