Restructure all http related files
Moving all http related functions and helpers into a new http submodule
This commit is contained in:
parent
0a0c185c06
commit
18bf623114
4 changed files with 4 additions and 4 deletions
16
http/chain.go
Normal file
16
http/chain.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"slices"
|
||||
)
|
||||
|
||||
type HandlerBuilder func(http.Handler) http.Handler
|
||||
|
||||
func ChainMiddlewares(base http.Handler, links ...HandlerBuilder) http.Handler {
|
||||
slices.Reverse(links)
|
||||
for _, f := range links {
|
||||
base = f(base)
|
||||
}
|
||||
return base
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue