package httpserver
import "net/http"
var (
ErrorPageBadRequest = `
Bad request | Journal` // 400
ErrorPageForbidden = `Forbidden | Journal` // 403
ErrorPageNotFound = `Not found | Journal` // 404
ErrorPageInternalServerError = `Internal server error | JournalInternal server error
error 500
` // 500
)
func BadRequest(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusBadRequest)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write([]byte(ErrorPageBadRequest))
}
func Forbidden(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusForbidden)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write([]byte(ErrorPageForbidden))
}
func NotFound(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write([]byte(ErrorPageNotFound))
}
func InternalServerError(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write([]byte(ErrorPageInternalServerError))
}