From 39050c16549dc03f1013e31e94fb45613f8cbe6b Mon Sep 17 00:00:00 2001 From: WeebDataHoarder <57538841+WeebDataHoarder@users.noreply.github.com> Date: Wed, 19 Jan 2022 21:14:33 +0100 Subject: [PATCH] Add ServeBytes method --- httputils/context.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/httputils/context.go b/httputils/context.go index c71bff6..518e410 100644 --- a/httputils/context.go +++ b/httputils/context.go @@ -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)