优化代码

This commit is contained in:
GoEdgeLab
2022-04-08 16:11:05 +08:00
parent 9d0467fe8a
commit bf604baf3d
6 changed files with 20 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeNode/internal/utils"
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
wafutils "github.com/TeaOSLab/EdgeNode/internal/waf/utils"
"github.com/iwind/TeaGo/maps"
"strings"
)
@@ -16,7 +17,7 @@ type RequestJSONArgCheckpoint struct {
func (this *RequestJSONArgCheckpoint) RequestValue(req requests.Request, param string, options maps.Map) (value interface{}, sysErr error, userErr error) {
var bodyData = req.WAFGetCacheBody()
if len(bodyData) == 0 {
data, err := req.WAFReadBody(int64(32 * 1024 * 1024)) // read 32m bytes
data, err := req.WAFReadBody(wafutils.MaxBodySize) // read body
if err != nil {
return "", err, nil
}