mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-11-06 08:05:22 +00:00
* feat: add MCP error metadata handling and improve source policy resolution * fix: adjust height-diff for improved table layout
16 lines
495 B
Go
16 lines
495 B
Go
package middleware
|
|
|
|
import (
|
|
"github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
|
|
mcpmeta "github.com/1Panel-dev/1Panel/core/utils/mcpapi/metadata"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func MCPErrorMetadata() gin.HandlerFunc {
|
|
return helper.WithErrorMetadata(func(c *gin.Context, _ int, messageKey string, _ error) {
|
|
if messageKey == "ErrProxy" && c.GetBool("MCP_API_AUTH") && c.Request != nil && mcpmeta.TrustedRequest(c.Request) {
|
|
c.Header(mcpmeta.BusinessCodeHeader, "ErrProxy")
|
|
}
|
|
})
|
|
}
|