...
|
...
|
@@ -20,14 +20,14 @@ type BaseController struct { |
|
|
|
|
|
//Prepare 实现beego.ControllerInterface 的接口
|
|
|
func (this *BaseController) Prepare() {
|
|
|
// this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
// this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Headers", "*")
|
|
|
// if this.Ctx.Input.Method() == "OPTIONS" {
|
|
|
// this.Ctx.ResponseWriter.WriteHeader(204)
|
|
|
// this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
|
|
|
// //this.Ctx.WriteString("")
|
|
|
// return
|
|
|
// }
|
|
|
this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Headers", "*")
|
|
|
if this.Ctx.Input.Method() == "OPTIONS" {
|
|
|
this.Ctx.ResponseWriter.WriteHeader(204)
|
|
|
this.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
|
|
|
//this.Ctx.WriteString("")
|
|
|
return
|
|
|
}
|
|
|
p := this.Ctx.Input.GetData("RouterPattern")
|
|
|
fmt.Println("====>r:", p)
|
|
|
}
|
...
|
...
|
|