File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,12 @@ func NewRouter() *Router {
3232// We also intercept any error handlers returned by the underlying mux, and replace them with any
3333// custom error handlers that have been registered.
3434func (rt * Router ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
35- handler , pattern := rt .Mux .Handler (r )
35+ if len (rt .errorHandlers ) == 0 {
36+ rt .Mux .ServeHTTP (w , r )
37+ return
38+ }
3639
40+ handler , pattern := rt .Mux .Handler (r )
3741 if pattern == "" && handler != nil {
3842 // If pattern is empty, we have an internal error handler. Check to see if we have a custom
3943 // error handler for this error code, and use that if we do.
@@ -44,7 +48,6 @@ func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
4448 handler = h
4549 }
4650 }
47-
4851 handler .ServeHTTP (w , r )
4952}
5053
You can’t perform that action at this time.
0 commit comments