prototyped svg reports
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s

This commit is contained in:
2026-08-19 23:19:41 -06:00
parent 00eed86bb2
commit 82efe19ae0
106 changed files with 5450 additions and 46 deletions
+23 -3
View File
@@ -11,8 +11,9 @@ import (
type (
htmlRes struct {
body []byte
res Response
body []byte
reader io.Reader
res Response
}
)
@@ -24,6 +25,12 @@ func HTML(body []byte) Response {
}
}
func HTMLReader(body io.Reader) Response {
return htmlRes{
reader: body,
}
}
func (h htmlRes) String() string {
if h.res != nil {
return fmt.Sprintf(`{"body": %q, "nested": %s}`, string(h.body), h.res)
@@ -46,6 +53,13 @@ func (h htmlRes) Redirect(code redirect.Code, to string) Response {
func (h htmlRes) HTML(body []byte) Response {
h.body = body
h.reader = nil
return h
}
func (h htmlRes) HTMLReader(body io.Reader) Response {
h.body = nil
h.reader = body
return h
}
@@ -133,7 +147,13 @@ func (h htmlRes) GetRedirect() (code redirect.Code, to string, ok bool) {
}
func (h htmlRes) getBody() (body io.ReadCloser, ok bool, err error) {
return io.NopCloser(bytes.NewBuffer(h.body)), true, nil
var r io.Reader
if h.reader != nil {
r = h.reader
} else {
r = bytes.NewBuffer(h.body)
}
return io.NopCloser(r), true, nil
}
func (h htmlRes) getCookies() []http.Cookie {