File tree Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -557,24 +557,31 @@ func (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request) {
557557	c  :=  e .pool .Get ().(* context )
558558	c .Reset (r , w )
559559
560- 	// Middleware 
561- 	h  :=  func (c  Context ) error  {
562- 		method  :=  r .Method 
563- 		path  :=  r .URL .RawPath 
564- 		if  path  ==  ""  {
565- 			path  =  r .URL .Path 
566- 		}
560+ 	method  :=  r .Method 
561+ 	path  :=  r .URL .RawPath 
562+ 	if  path  ==  ""  {
563+ 		path  =  r .URL .Path 
564+ 	}
565+ 	h  :=  NotFoundHandler 
566+ 
567+ 	if  e .premiddleware  ==  nil  {
567568		e .router .Find (method , path , c )
568- 		h  : =c .Handler ()
569+ 		h  =  c .Handler ()
569570		for  i  :=  len (e .middleware ) -  1 ; i  >=  0 ; i --  {
570571			h  =  e.middleware [i ](h )
571572		}
572- 		return  h (c )
573- 	}
574- 
575- 	// Premiddleware 
576- 	for  i  :=  len (e .premiddleware ) -  1 ; i  >=  0 ; i --  {
577- 		h  =  e.premiddleware [i ](h )
573+ 	} else  {
574+ 		h  =  func (c  Context ) error  {
575+ 			e .router .Find (method , path , c )
576+ 			h  :=  c .Handler ()
577+ 			for  i  :=  len (e .middleware ) -  1 ; i  >=  0 ; i --  {
578+ 				h  =  e.middleware [i ](h )
579+ 			}
580+ 			return  h (c )
581+ 		}
582+ 		for  i  :=  len (e .premiddleware ) -  1 ; i  >=  0 ; i --  {
583+ 			h  =  e.premiddleware [i ](h )
584+ 		}
578585	}
579586
580587	// Execute chain 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments