相应类型增加编码utf-8

This commit is contained in:
白茶清欢 2025-04-29 14:22:27 +08:00
parent 03963ce8e3
commit 0bd02dbd08

View File

@ -8,8 +8,8 @@
package response package response
import ( import (
"git.zhangdeman.cn/zhangdeman/dynamic-struct/wrapper"
"fmt" "fmt"
"git.zhangdeman.cn/zhangdeman/dynamic-struct/wrapper"
"git.zhangdeman.cn/zhangdeman/serialize" "git.zhangdeman.cn/zhangdeman/serialize"
"net/http" "net/http"
"strings" "strings"
@ -67,12 +67,12 @@ func SuccessWithExtension(ctx *gin.Context, data any, responseOption *define.Res
func Send(ctx *gin.Context, code any, httpCode int, data any, responseOption *define.ResponseOption) { func Send(ctx *gin.Context, code any, httpCode int, data any, responseOption *define.ResponseOption) {
if nil == responseOption { if nil == responseOption {
responseOption = &define.ResponseOption{ responseOption = &define.ResponseOption{
ContentType: "application/json", ContentType: "application/json; charset=utf-8",
Extension: make(map[string]any), Extension: make(map[string]any),
} }
} }
if len(responseOption.ContentType) == 0 { if len(responseOption.ContentType) == 0 {
responseOption.ContentType = "application/json" responseOption.ContentType = "application/json; charset=utf-8"
} }
if len(responseOption.XmlName) == 0 { if len(responseOption.XmlName) == 0 {
responseOption.XmlName = "ResponseData" responseOption.XmlName = "ResponseData"