1 Star 0 Fork 0

yangtxiang / mg-fw

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
http_res.go 430 Bytes
一键复制 编辑 原始数据 按行查看 历史
yangtxiang 提交于 2022-08-20 09:42 . init
package net
import (
"encoding/json"
"net/http"
)
type HttpRes struct {
ContentType string `json:"contentType"`
Status string
StatusCode int
Body []byte
Cookies []*http.Cookie
}
func (hr *HttpRes) IsError() bool {
return hr.StatusCode != http.StatusOK
}
func (hr *HttpRes) Unmarshal(res any) error {
return json.Unmarshal(hr.Body, res)
}
func (hr *HttpRes) Text() string {
return string(hr.Body)
}
Go
1
https://gitee.com/maglsoft/mg-fw.git
git@gitee.com:maglsoft/mg-fw.git
maglsoft
mg-fw
mg-fw
v0.0.5

搜索帮助

53164aa7 5694891 3bd8fe86 5694891