package httpserver import "net/http" var ( ErrorPageBadRequest = `Bad request | Journal

Bad request

error 400

` // 400 ErrorPageForbidden = `Forbidden | Journal

Forbidden

error 403

` // 403 ErrorPageNotFound = `Not found | Journal

Not found

error 404

` // 404 ErrorPageInternalServerError = `Internal server error | Journal

Internal 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)) }