Explorar o código

fix: allow all origins (close #20)

JustSong %!s(int64=2) %!d(string=hai) anos
pai
achega
e7a809b082
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      middleware/cors.go

+ 3 - 0
middleware/cors.go

@@ -8,5 +8,8 @@ import (
 func CORS() gin.HandlerFunc {
 	config := cors.DefaultConfig()
 	config.AllowAllOrigins = true
+	config.AllowCredentials = true
+	config.AllowMethods = []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}
+	config.AllowHeaders = []string{"Origin", "Content-Length", "Content-Type", "Authorization", "Accept", "Connection"}
 	return cors.New(config)
 }