20 lines
379 B
Go
20 lines
379 B
Go
package middlewares
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
func (f *Middlewares) WechatMpVerify(ctx fiber.Ctx) error {
|
|
if !strings.HasPrefix(ctx.Path(), "/MP_verify_") {
|
|
return ctx.Next()
|
|
}
|
|
|
|
path := strings.Replace(ctx.Path(), "MP_verify_", "", 1)
|
|
path = strings.Replace(path, ".txt", "", 1)
|
|
path = strings.Trim(path, "/")
|
|
|
|
return ctx.SendString(path)
|
|
}
|