mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-10-01 04:13:41 +00:00
19 lines
430 B
Go
19 lines
430 B
Go
|
//go:build !fasthttp
|
||
|
|
||
|
package html
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"io"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
// 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")
|
||
|
|
||
|
resp.Body = io.NopCloser(bytes.NewReader(errorBody(code)))
|
||
|
}
|