Add ServeBytes method
This commit is contained in:
parent
7bfcd667a1
commit
39050c1654
|
@ -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) {
|
func (c *RequestContext) SetResponseCode(code int) {
|
||||||
if c.fasthttp != nil {
|
if c.fasthttp != nil {
|
||||||
c.fasthttp.Response.SetStatusCode(code)
|
c.fasthttp.Response.SetStatusCode(code)
|
||||||
|
|
Loading…
Reference in a new issue