refactor: replace json with json-iterator/go to improve performance

This commit is contained in:
debugtalk
2022-03-04 17:39:15 +08:00
parent 54431f205b
commit ce4c3d414e
12 changed files with 37 additions and 13 deletions

View File

@@ -2,7 +2,7 @@ package hrp
import (
"bytes"
"encoding/json"
builtinJSON "encoding/json"
"fmt"
"io"
"net/http"
@@ -15,6 +15,7 @@ import (
"github.com/rs/zerolog/log"
"github.com/httprunner/hrp/internal/builtin"
"github.com/httprunner/hrp/internal/json"
)
func newResponseObject(t *testing.T, parser *parser, resp *http.Response) (*responseObject, error) {
@@ -184,7 +185,7 @@ func (v *responseObject) searchJmespath(expr string) interface{} {
log.Error().Str("expr", expr).Err(err).Msg("search jmespath failed")
return expr // jmespath not found, return the expression
}
if number, ok := checkValue.(json.Number); ok {
if number, ok := checkValue.(builtinJSON.Number); ok {
checkNumber, err := parseJSONNumber(number)
if err != nil {
log.Error().Interface("json number", number).Err(err).Msg("convert json number failed")