MCPcopy Create free account
hub / github.com/coderabbit214/document-ai / Cors

Function Cors

pkg/api/routers.go:33–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31}
32
33func Cors() gin.HandlerFunc {
34 return func(c *gin.Context) {
35 method := c.Request.Method
36 origin := c.Request.Header.Get("Origin")
37 if origin != "" {
38 c.Header("Access-Control-Allow-Origin", "*")
39 c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
40 c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization")
41 c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type")
42 c.Header("Access-Control-Allow-Credentials", "true")
43 }
44 if method == "OPTIONS" {
45 c.AbortWithStatus(http.StatusNoContent)
46 }
47 c.Next()
48 }
49}

Callers 1

SetupRouterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected