Add empty test api version header checker

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-20 15:22:09 +08:00
parent 164e271d81
commit 087cd4ee51
2 changed files with 16 additions and 1 deletions

14
middleware/api_version.go Normal file
View File

@@ -0,0 +1,14 @@
package middleware
import "github.com/gin-gonic/gin"
func ApiVersionCheck() gin.HandlerFunc {
return func(c *gin.Context) {
apiVersion := c.GetHeader("X-Api-Version")
if apiVersion == "" {
c.Abort()
return
}
c.Next()
}
}