rm cache from fasthttp

This commit is contained in:
6543 2022-07-27 17:25:08 +02:00
parent 33298aa8ff
commit 6fd9cbfafb
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE
12 changed files with 425 additions and 250 deletions

View file

@ -5,14 +5,15 @@ package html
import (
"bytes"
"io"
"net/http"
"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(resp *http.Response, code int) {
resp.StatusCode = code
resp.Header.Set("Content-Type", "text/html; charset=utf-8")
func ReturnErrorPage(ctx *context.Context, code int) {
ctx.RespWriter.Header().Set("Content-Type", "text/html; charset=utf-8")
ctx.RespWriter.WriteHeader(code)
resp.Body = io.NopCloser(bytes.NewReader(errorBody(code)))
io.Copy(ctx.RespWriter, bytes.NewReader(errorBody(code)))
}