feat: generate html reports for API testing #74

This commit is contained in:
xucong053
2022-02-08 15:35:02 +08:00
parent a20763d212
commit f85e1aad5e

View File

@@ -137,8 +137,12 @@ func formatValue(raw interface{}) interface{} {
case reflect.Map: case reflect.Map:
m := make(map[string]interface{}) m := make(map[string]interface{})
for key, value := range rawValue.Interface().(map[string]interface{}) { for key, value := range rawValue.Interface().(map[string]interface{}) {
b, _ := json.MarshalIndent(&value, "", " ") fmtValue, ok := value.(string)
m[key] = string(b) if !ok {
b, _ := json.MarshalIndent(&value, "", " ")
fmtValue = string(b)
}
m[key] = fmtValue
} }
return m return m
case reflect.Slice: case reflect.Slice: