middleware stacking bug fix

This commit is contained in:
2025-08-16 19:25:00 +05:30
parent 5885b42816
commit ec4a0ac231
4 changed files with 19 additions and 23 deletions

View File

@@ -3,7 +3,7 @@ package mux
import "net/http"
// stack middlewares(http handler) in order they are passed (FIFO)
func stack(middlewares []func(http.Handler) http.Handler, endpoint http.Handler) http.Handler {
func stack(endpoint http.Handler, middlewares []func(http.Handler) http.Handler) http.Handler {
// Return ahead of time if there aren't any middlewares for the chain
if len(middlewares) == 0 {
return endpoint