mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 06:16:58 +00:00
rm cache from fasthttp
This commit is contained in:
parent
33298aa8ff
commit
6fd9cbfafb
12 changed files with 425 additions and 250 deletions
|
@ -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)))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue