From d893999f5f35dce33eb1c2aedb5f7e00643e96bf Mon Sep 17 00:00:00 2001 From: xucong053 Date: Tue, 8 Feb 2022 15:35:02 +0800 Subject: [PATCH] feat: generate html reports for API testing #74 --- internal/builtin/function.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/builtin/function.go b/internal/builtin/function.go index e875b68f..ddeb13b1 100644 --- a/internal/builtin/function.go +++ b/internal/builtin/function.go @@ -137,8 +137,12 @@ func formatValue(raw interface{}) interface{} { case reflect.Map: m := make(map[string]interface{}) for key, value := range rawValue.Interface().(map[string]interface{}) { - b, _ := json.MarshalIndent(&value, "", " ") - m[key] = string(b) + fmtValue, ok := value.(string) + if !ok { + b, _ := json.MarshalIndent(&value, "", " ") + fmtValue = string(b) + } + m[key] = fmtValue } return m case reflect.Slice: