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:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-05 17:44:39 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-05 17:44:39 +0300
commita8942247992d272ae29074d362a2c6b7de6bf96b (patch)
treeda283ce60549d0cba61a95a8e37fc226489962ea
parent525b9a33476e97f5a2a006cb4e4ff7959722d467 (diff)
Fix predefined 404 Content-Type
-rw-r--r--404.go4
-rw-r--r--domain_test.go16
2 files changed, 15 insertions, 5 deletions
diff --git a/404.go b/404.go
index 3634ddf0..0ac0be54 100644
--- a/404.go
+++ b/404.go
@@ -1,8 +1,8 @@
package main
import (
- "net/http"
"fmt"
+ "net/http"
)
const predefined404 = `
@@ -63,7 +63,7 @@ const predefined404 = `
`
func serve404(w http.ResponseWriter) {
- w.Header().Set("Content-Type", "text/plain; charset=utf-8")
+ w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.WriteHeader(http.StatusNotFound)
fmt.Fprintln(w, predefined404)
diff --git a/domain_test.go b/domain_test.go
index 56e032a4..9032aeee 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -2,12 +2,12 @@ package main
import (
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+ "mime"
"net/http"
+ "net/http/httptest"
"net/url"
"testing"
- "net/http/httptest"
- "github.com/stretchr/testify/require"
- "mime"
)
func TestGroupServeHTTP(t *testing.T) {
@@ -95,6 +95,16 @@ func TestDomain404ServeHTTP(t *testing.T) {
testHTTP404(t, testDomain.ServeHTTP, "GET", "http://group.404.test.io/", nil, "Custom 404 group page")
}
+func TestPredefined404ServeHTTP(t *testing.T) {
+ setUpTests()
+
+ testDomain := &domain{
+ Group: "group",
+ }
+
+ testHTTP404(t, testDomain.ServeHTTP, "GET", "http://group.test.io/not-existing-file", nil, "The page you're looking for could not be found")
+}
+
func TestGroupCertificate(t *testing.T) {
testGroup := &domain{
Group: "group",