[#5940] added blob response write helper

This commit is contained in:
Gani Georgiev
2024-11-25 09:11:13 +02:00
parent 8f6e91c485
commit 5a5211d7f2
4 changed files with 6271 additions and 6232 deletions

View File

@@ -221,6 +221,14 @@ func (e *Event) Stream(status int, contentType string, reader io.Reader) error {
return err
}
// Blob writes a blob (bytes slice) response.
func (e *Event) Blob(status int, contentType string, b []byte) error {
e.setResponseHeaderIfEmpty(headerContentType, contentType)
e.Response.WriteHeader(status)
_, err := e.Response.Write(b)
return err
}
// FileFS serves the specified filename from fsys.
//
// It is similar to [echo.FileFS] for consistency with earlier versions.