1 Star 0 Fork 2

QunXiongZhuLu / kratos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
data.go 581 Bytes
一键复制 编辑 原始数据 按行查看 历史
realityone 提交于 2019-04-11 15:07 . blademaster initial (#6)
package render
import (
"net/http"
"github.com/pkg/errors"
)
// Data common bytes struct.
type Data struct {
ContentType string
Data [][]byte
}
// Render (Data) writes data with custom ContentType.
func (r Data) Render(w http.ResponseWriter) (err error) {
r.WriteContentType(w)
for _, d := range r.Data {
if _, err = w.Write(d); err != nil {
err = errors.WithStack(err)
return
}
}
return
}
// WriteContentType writes data with custom ContentType.
func (r Data) WriteContentType(w http.ResponseWriter) {
writeContentType(w, []string{r.ContentType})
}
1
https://gitee.com/QunXiongZhuLu/kratos.git
git@gitee.com:QunXiongZhuLu/kratos.git
QunXiongZhuLu
kratos
kratos
v0.6.2

搜索帮助

53164aa7 5694891 3bd8fe86 5694891