作者 tangxvhui

跨域调整

... ... @@ -42,5 +42,5 @@ func logLevel(s string) (i int) {
}
func PrintSql(bt []byte) {
logs.Debug(string(bt))
logs.Debug("SQL PRINT : ", string(bt))
}
... ...
... ... @@ -94,9 +94,9 @@ func (controller *BaseController) Prepare() {
if controller.Ctx.Input.IsPost() || controller.Ctx.Input.IsPut() {
bodyByte := controller.Ctx.Input.RequestBody
if len(bodyByte) > 1000 {
logs.Info("====>Recv data from client: BodyData:\n ", string(bodyByte[0:1000]))
logs.Info("====>Recv data from client: BodyData: ", string(bodyByte[0:1000]))
} else {
logs.Info("====>Recv data from client: BodyData: \n ", string(bodyByte))
logs.Info("====>Recv data from client: BodyData: ", string(bodyByte))
}
}
return
... ...
... ... @@ -13,9 +13,9 @@ func AllowCors() func(ctx *context.Context) {
//其中Options跨域复杂请求预检
AllowMethods: []string{"*"},
//指的是允许的Header的种类
AllowHeaders: []string{"*"},
AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Content-Type"},
//公开的HTTP标头列表
ExposeHeaders: []string{"Content-Length"},
ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
//如果设置,则允许共享身份验证凭据,例如cookie
AllowCredentials: true,
})
... ...