add header filter

This commit is contained in:
kandrusyak
2023-06-23 18:05:01 +03:00
parent eab7ec0c90
commit 7d2aaf40e4
5 changed files with 64 additions and 11 deletions

17
mw/filter_headers.go Normal file
View File

@@ -0,0 +1,17 @@
package mw
import (
"github.com/labstack/echo/v4"
)
var NOT_ALLOWED_HEADERS = [2]string{"UserId", "Authorization"}
func FilterHeaders(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
for _, header := range NOT_ALLOWED_HEADERS {
c.Request().Header.Set(header, "")
}
return next(c)
}
}