diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2020-10-13 13:52:51 +0300 |
---|---|---|
committer | Vladimir Shushlin <vshushlin@gitlab.com> | 2020-10-13 13:52:51 +0300 |
commit | 16a1e15632fa670e15ed512753380f45965f26d0 (patch) | |
tree | 8d298b27342decb4c146f386f093082c2103b2f0 /acceptance_test.go | |
parent | 6755ba75aff4044f7dfa40578426195b9922907a (diff) | |
parent | 77b42fad727a8d8166d8d9a3aa6951f530a664ea (diff) |
Merge branch 'feature/brotli' into 'master'
Support for statically compressed brotli content-encoding
See merge request gitlab-org/gitlab-pages!359
Diffstat (limited to 'acceptance_test.go')
-rw-r--r-- | acceptance_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/acceptance_test.go b/acceptance_test.go index a3fedc24..69ec8742 100644 --- a/acceptance_test.go +++ b/acceptance_test.go @@ -660,6 +660,44 @@ func TestObscureMIMEType(t *testing.T) { require.Equal(t, "application/manifest+json", mt) } +func TestCompressedEncoding(t *testing.T) { + skipUnlessEnabled(t) + + tests := []struct { + name string + host string + path string + encoding string + }{ + { + "gzip encoding", + "group.gitlab-example.com", + "index.html", + "gzip", + }, + { + "brotli encoding", + "group.gitlab-example.com", + "index.html", + "br", + }, + } + + teardown := RunPagesProcess(t, *pagesBinary, listeners, "") + defer teardown() + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + rsp, err := GetCompressedPageFromListener(t, httpListener, "group.gitlab-example.com", "index.html", tt.encoding) + require.NoError(t, err) + defer rsp.Body.Close() + + require.Equal(t, http.StatusOK, rsp.StatusCode) + require.Equal(t, tt.encoding, rsp.Header.Get("Content-Encoding")) + }) + } +} + func TestArtifactProxyRequest(t *testing.T) { skipUnlessEnabled(t, "not-inplace-chroot") |