Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/httperrors/httperrors.go')
-rw-r--r--internal/httperrors/httperrors.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/httperrors/httperrors.go b/internal/httperrors/httperrors.go
index 92413e07..1ae5224b 100644
--- a/internal/httperrors/httperrors.go
+++ b/internal/httperrors/httperrors.go
@@ -14,6 +14,13 @@ type content struct {
}
var (
+ content401 = content{
+ http.StatusUnauthorized,
+ "Unauthorized (401)",
+ "401",
+ "You don't have permission to access the resource.",
+ `<p>The resource that you are attempting to access is protected and you don't have the necessary permissions to view it.</p>`,
+ }
content404 = content{
http.StatusNotFound,
"The page you're looking for could not be found (404)",
@@ -155,6 +162,11 @@ func serveErrorPage(w http.ResponseWriter, c content) {
fmt.Fprintln(w, generateErrorHTML(c))
}
+// Serve401 returns a 401 error response / HTML page to the http.ResponseWriter
+func Serve401(w http.ResponseWriter) {
+ serveErrorPage(w, content401)
+}
+
// Serve404 returns a 404 error response / HTML page to the http.ResponseWriter
func Serve404(w http.ResponseWriter) {
serveErrorPage(w, content404)