|
@@ -74,12 +74,14 @@ func (s *sussBi) Filter(r *ghttp.Request) error {
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- finalBytes := bytes.ReplaceAll(bodyBytes, []byte(`"jyUserId"`), []byte(fmt.Sprintf(`"%d"`, ctx.Sess.NewUid)))
|
|
|
- r.ContentLength = gconv.Int64(len(finalBytes))
|
|
|
- r.Request.Header.Set("Content-Length", fmt.Sprintf("%d", len(finalBytes)))
|
|
|
- //fmt.Printf("before len:%d value:%s\nafter: len:%d value:%s\n", len(bodyBytes), string(bodyBytes), len(finalBytes), string(finalBytes))
|
|
|
- //fmt.Printf("header %+v\n", r.Request.Header)
|
|
|
- r.Request.Body = ioutil.NopCloser(bytes.NewReader(finalBytes))
|
|
|
+ if len(bodyBytes) > 0 {
|
|
|
+ finalBytes := bytes.ReplaceAll(bodyBytes, []byte(`"jyUserId"`), []byte(fmt.Sprintf(`"%d"`, ctx.Sess.NewUid)))
|
|
|
+ r.ContentLength = gconv.Int64(len(finalBytes))
|
|
|
+ r.Request.Header.Set("Content-Length", fmt.Sprintf("%d", len(finalBytes)))
|
|
|
+ //fmt.Printf("before len:%d value:%s\nafter: len:%d value:%s\n", len(bodyBytes), string(bodyBytes), len(finalBytes), string(finalBytes))
|
|
|
+ //fmt.Printf("header %+v\n", r.Request.Header)
|
|
|
+ r.Request.Body = ioutil.NopCloser(bytes.NewReader(finalBytes))
|
|
|
+ }
|
|
|
}
|
|
|
return nil
|
|
|
}
|