Add ServeBytes method

This commit is contained in:
DataHoarder 2022-01-19 21:14:33 +01:00
parent 7bfcd667a1
commit 39050c1654

View file

@ -143,6 +143,14 @@ func (c *RequestContext) ServeFile(path string) {
}
}
func (c *RequestContext) ServeBytes(content []byte) {
if c.fasthttp != nil {
c.fasthttp.Write(content)
} else if c.httpWriter != nil {
(*c.httpWriter).Write(content)
}
}
func (c *RequestContext) SetResponseCode(code int) {
if c.fasthttp != nil {
c.fasthttp.Response.SetStatusCode(code)