正在显示
3 个修改的文件
包含
5 行增加
和
5 行删除
| @@ -94,9 +94,9 @@ func (controller *BaseController) Prepare() { | @@ -94,9 +94,9 @@ func (controller *BaseController) Prepare() { | ||
| 94 | if controller.Ctx.Input.IsPost() || controller.Ctx.Input.IsPut() { | 94 | if controller.Ctx.Input.IsPost() || controller.Ctx.Input.IsPut() { |
| 95 | bodyByte := controller.Ctx.Input.RequestBody | 95 | bodyByte := controller.Ctx.Input.RequestBody |
| 96 | if len(bodyByte) > 1000 { | 96 | if len(bodyByte) > 1000 { |
| 97 | - logs.Info("====>Recv data from client: BodyData:\n ", string(bodyByte[0:1000])) | 97 | + logs.Info("====>Recv data from client: BodyData: ", string(bodyByte[0:1000])) |
| 98 | } else { | 98 | } else { |
| 99 | - logs.Info("====>Recv data from client: BodyData: \n ", string(bodyByte)) | 99 | + logs.Info("====>Recv data from client: BodyData: ", string(bodyByte)) |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
| 102 | return | 102 | return |
| @@ -13,9 +13,9 @@ func AllowCors() func(ctx *context.Context) { | @@ -13,9 +13,9 @@ func AllowCors() func(ctx *context.Context) { | ||
| 13 | //其中Options跨域复杂请求预检 | 13 | //其中Options跨域复杂请求预检 |
| 14 | AllowMethods: []string{"*"}, | 14 | AllowMethods: []string{"*"}, |
| 15 | //指的是允许的Header的种类 | 15 | //指的是允许的Header的种类 |
| 16 | - AllowHeaders: []string{"*"}, | 16 | + AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Content-Type"}, |
| 17 | //公开的HTTP标头列表 | 17 | //公开的HTTP标头列表 |
| 18 | - ExposeHeaders: []string{"Content-Length"}, | 18 | + ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"}, |
| 19 | //如果设置,则允许共享身份验证凭据,例如cookie | 19 | //如果设置,则允许共享身份验证凭据,例如cookie |
| 20 | AllowCredentials: true, | 20 | AllowCredentials: true, |
| 21 | }) | 21 | }) |
-
请 注册 或 登录 后发表评论