|
@@ -4,6 +4,7 @@ import (
|
|
|
"fmt"
|
|
|
"git.aionnect.com/aionnect/go-common/utils"
|
|
|
"git.aionnect.com/aionnect/go-common/utils/date"
|
|
|
+ "git.aionnect.com/aionnect/go-common/utils/jsonutil"
|
|
|
"git.aionnect.com/aionnect/go-common/utils/logger"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"net/http"
|
|
@@ -68,8 +69,8 @@ func Recovery(hostPrefix string, logger *logger.Logger) gin.HandlerFunc {
|
|
|
}
|
|
|
if i, ok := ctxt.Get(IsLogHTTPResponse); ok {
|
|
|
if isLogHttpResponse, ok := i.(bool); ok && isLogHttpResponse {
|
|
|
- respB, _ := res.MarshalJSON()
|
|
|
- logger = logger.WithField("responseBody", string(respB))
|
|
|
+ respStr, _ := jsonutil.MarshalToString(res)
|
|
|
+ logger = logger.WithField("responseBody", respStr)
|
|
|
}
|
|
|
}
|
|
|
logger.
|
|
@@ -85,8 +86,8 @@ func Recovery(hostPrefix string, logger *logger.Logger) gin.HandlerFunc {
|
|
|
res := utils.E(9999, "未定义", nil)
|
|
|
if i, ok := ctxt.Get(IsLogHTTPResponse); ok {
|
|
|
if isLogHttpResponse, ok := i.(bool); ok && isLogHttpResponse {
|
|
|
- respB, _ := res.MarshalJSON()
|
|
|
- logger = logger.WithField("responseBody", string(respB))
|
|
|
+ respStr, _ := jsonutil.MarshalToString(res)
|
|
|
+ logger = logger.WithField("responseBody", respStr)
|
|
|
}
|
|
|
}
|
|
|
logger.
|