REMOVE fasthttp version

This commit is contained in:
6543 2022-08-28 20:54:17 +02:00
parent ea13ac0e92
commit 16a8d5d575
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE
26 changed files with 331 additions and 1339 deletions

View file

@ -1,11 +1,27 @@
package html
import (
"io"
"net/http"
"strconv"
"strings"
"codeberg.org/codeberg/pages/server/context"
)
// ReturnErrorPage sets the response status code and writes NotFoundPage to the response body, with "%status" replaced
// with the provided status code.
func ReturnErrorPage(ctx *context.Context, msg string, code int) {
ctx.RespWriter.Header().Set("Content-Type", "text/html; charset=utf-8")
ctx.RespWriter.WriteHeader(code)
if msg == "" {
msg = errorBody(code)
}
_, _ = io.Copy(ctx.RespWriter, strings.NewReader(msg))
}
func errorMessage(statusCode int) string {
message := http.StatusText(statusCode)