作者 yangfu

1.路由修改

@@ -35,17 +35,18 @@ func CreateResponseLogFilter(logger *logs.BeeLogger) func(ctx *context.Context) @@ -35,17 +35,18 @@ func CreateResponseLogFilter(logger *logs.BeeLogger) func(ctx *context.Context)
35 35
36 func CreateRequestBodyFilter() func(ctx *context.Context) { 36 func CreateRequestBodyFilter() func(ctx *context.Context) {
37 return func(ctx *context.Context) { 37 return func(ctx *context.Context) {
38 - if len(ctx.Input.RequestBody) == 0 {  
39 - if ctx.Request.Method == http.MethodPost || ctx.Request.Method == http.MethodPut {  
40 - body, _ := ioutil.ReadAll(ctx.Request.Body)  
41 - if len(body) == 0 {  
42 - body = []byte("{}")  
43 - }  
44 - ctx.Input.SetData("requestBody", body)  
45 - ctx.Request.Body.Close() 38 + if ctx.Request.Method == http.MethodPost || ctx.Request.Method == http.MethodPut {
  39 + body, _ := ioutil.ReadAll(ctx.Request.Body)
  40 + if len(body) == 0 {
  41 + body = []byte("{}")
46 } 42 }
47 - } else {  
48 - ctx.Input.SetData("requestBody", ctx.Input.RequestBody) 43 + ctx.Input.SetData("requestBody", body)
  44 + ctx.Request.Body.Close()
49 } 45 }
  46 + //if len(ctx.Input.RequestBody) == 0 {
  47 + //
  48 + //} else {
  49 + // ctx.Input.SetData("requestBody", ctx.Input.RequestBody)
  50 + //}
50 } 51 }
51 } 52 }