start ...

This commit is contained in:
6543 2022-07-15 18:10:41 +02:00
parent 9076bc3f75
commit 6f56fa97a1
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE
11 changed files with 519 additions and 13 deletions

20
html/error_fasthttp.go Normal file
View file

@ -0,0 +1,20 @@
//go:build fasthttp
package html
import (
"bytes"
"strconv"
"github.com/valyala/fasthttp"
)
// ReturnErrorPage sets the response status code and writes NotFoundPage to the response body, with "%status" replaced
// with the provided status code.
func ReturnErrorPage(ctx *fasthttp.RequestCtx, code int) {
ctx.Response.SetStatusCode(code)
ctx.Response.Header.SetContentType("text/html; charset=utf-8")
// TODO: use template engine?
ctx.Response.SetBody(errorBody(code))
}