1 Star 1 Fork 0

颜言/gopay

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
model.go 882 Bytes
一键复制 编辑 原始数据 按行查看 历史
颜言 提交于 2024-09-12 18:02 +08:00 . 原版
package xhttp
import "encoding/json"
const (
GET = "GET"
POST = "POST"
PUT = "PUT"
DELETE = "DELETE"
PATCH = "PATCH"
ResTypeJSON = "json"
ResTypeXML = "xml"
TypeJSON = "json"
TypeXML = "xml"
TypeFormData = "form-data"
TypeMultipartFormData = "multipart-form-data"
)
var (
_ReqContentTypeMap = map[string]string{
TypeJSON: "application/json",
TypeXML: "application/xml",
TypeFormData: "application/x-www-form-urlencoded",
TypeMultipartFormData: "multipart/form-data",
}
_ResTypeMap = map[string]string{
ResTypeJSON: "application/json",
ResTypeXML: "application/xml",
}
)
func ConvertToString(v any) (str string) {
if v == nil {
return ""
}
var (
bs []byte
err error
)
if bs, err = json.Marshal(v); err != nil {
return ""
}
str = string(bs)
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ujq/gopay.git
git@gitee.com:ujq/gopay.git
ujq
gopay
gopay
95cb943fb81a

搜索帮助