fix issue with favicon

This commit is contained in:
vysion 2021-07-07 18:29:41 -07:00
parent 368cae2676
commit f7e5a01008
1 changed files with 5 additions and 2 deletions

View File

@ -7,10 +7,13 @@ import (
)
func ServeFavicon(ctx *fasthttp.RequestCtx) {
f, _ := Favicon.ReadFile("favicon.ico")
f, e := Favicon.ReadFile("./conf/favicon.ico")
if e != nil {
ctx.Response.SetStatusCode(fasthttp.StatusInternalServerError)
}
b := bytes.NewBuffer(f)
ctx.Response.Header.Set("Content-Type", "image/x-icon")
_, e := io.Copy(ctx.Response.BodyWriter(), b)
_, e = io.Copy(ctx.Response.BodyWriter(), b)
if e != nil {
ctx.Response.SetStatusCode(fasthttp.StatusInternalServerError)
}