feat: 配置 CORS 以暴露上游响应时间标头

- 在 CORS 配置中添加 `x-one-api-upstream-time` 到 ExposeHeaders
This commit is contained in:
Shine 2025-03-12 18:58:10 +08:00
parent 7a9c4e1b93
commit dbe2b54099

View File

@ -11,5 +11,6 @@ func CORS() gin.HandlerFunc {
config.AllowCredentials = true config.AllowCredentials = true
config.AllowMethods = []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"} config.AllowMethods = []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}
config.AllowHeaders = []string{"*"} config.AllowHeaders = []string{"*"}
config.ExposeHeaders = []string{"x-one-api-upstream-time"}
return cors.New(config) return cors.New(config)
} }