|
|
|
@ -34,9 +34,9 @@ func TestDownloadByIDForSVGUsesSecureHeaders(t *testing.T) { |
|
|
|
|
req := NewRequest(t, "GET", "/user2/repo2/raw/blob/6395b68e1feebb1e4c657b4f9f6ba2676a283c0b") |
|
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
|
|
|
|
|
assert.Equal(t, "default-src 'none'; style-src 'unsafe-inline'; sandbox", resp.HeaderMap.Get("Content-Security-Policy")) |
|
|
|
|
assert.Equal(t, "image/svg+xml", resp.HeaderMap.Get("Content-Type")) |
|
|
|
|
assert.Equal(t, "nosniff", resp.HeaderMap.Get("X-Content-Type-Options")) |
|
|
|
|
assert.Equal(t, "default-src 'none'; style-src 'unsafe-inline'; sandbox", resp.Header().Get("Content-Security-Policy")) |
|
|
|
|
assert.Equal(t, "image/svg+xml", resp.Header().Get("Content-Type")) |
|
|
|
|
assert.Equal(t, "nosniff", resp.Header().Get("X-Content-Type-Options")) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestDownloadByIDMedia(t *testing.T) { |
|
|
|
@ -60,9 +60,9 @@ func TestDownloadByIDMediaForSVGUsesSecureHeaders(t *testing.T) { |
|
|
|
|
req := NewRequest(t, "GET", "/user2/repo2/media/blob/6395b68e1feebb1e4c657b4f9f6ba2676a283c0b") |
|
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
|
|
|
|
|
assert.Equal(t, "default-src 'none'; style-src 'unsafe-inline'; sandbox", resp.HeaderMap.Get("Content-Security-Policy")) |
|
|
|
|
assert.Equal(t, "image/svg+xml", resp.HeaderMap.Get("Content-Type")) |
|
|
|
|
assert.Equal(t, "nosniff", resp.HeaderMap.Get("X-Content-Type-Options")) |
|
|
|
|
assert.Equal(t, "default-src 'none'; style-src 'unsafe-inline'; sandbox", resp.Header().Get("Content-Security-Policy")) |
|
|
|
|
assert.Equal(t, "image/svg+xml", resp.Header().Get("Content-Type")) |
|
|
|
|
assert.Equal(t, "nosniff", resp.Header().Get("X-Content-Type-Options")) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestDownloadRawTextFileWithoutMimeTypeMapping(t *testing.T) { |
|
|
|
@ -73,7 +73,7 @@ func TestDownloadRawTextFileWithoutMimeTypeMapping(t *testing.T) { |
|
|
|
|
req := NewRequest(t, "GET", "/user2/repo2/raw/branch/master/test.xml") |
|
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
|
|
|
|
|
assert.Equal(t, "text/plain; charset=utf-8", resp.HeaderMap.Get("Content-Type")) |
|
|
|
|
assert.Equal(t, "text/plain; charset=utf-8", resp.Header().Get("Content-Type")) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestDownloadRawTextFileWithMimeTypeMapping(t *testing.T) { |
|
|
|
@ -86,7 +86,7 @@ func TestDownloadRawTextFileWithMimeTypeMapping(t *testing.T) { |
|
|
|
|
req := NewRequest(t, "GET", "/user2/repo2/raw/branch/master/test.xml") |
|
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
|
|
|
|
|
assert.Equal(t, "text/xml; charset=utf-8", resp.HeaderMap.Get("Content-Type")) |
|
|
|
|
assert.Equal(t, "text/xml; charset=utf-8", resp.Header().Get("Content-Type")) |
|
|
|
|
|
|
|
|
|
delete(setting.MimeTypeMap.Map, ".xml") |
|
|
|
|
setting.MimeTypeMap.Enabled = false |
|
|
|
|