fix gitea workflow path and runner label
Build docker and publish / build (20.15.1) (push) Failing after 7m57s
Build docker and publish / build (20.15.1) (push) Failing after 7m57s
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/perfect-panel/server/pkg/constant"
|
||||
)
|
||||
|
||||
func ApiVersionSwitchHandler(legacyHandler gin.HandlerFunc, latestHandler gin.HandlerFunc) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
useLatest, _ := c.Request.Context().Value(constant.CtxKeyAPIVersionUseLatest).(bool)
|
||||
if useLatest && latestHandler != nil {
|
||||
latestHandler(c)
|
||||
return
|
||||
}
|
||||
if legacyHandler != nil {
|
||||
legacyHandler(c)
|
||||
return
|
||||
}
|
||||
c.AbortWithStatus(http.StatusNotFound)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user