debian-mirror-gitlab/workhorse/internal/headers/headers_test.go

25 lines
701 B
Go
Raw Normal View History

2021-02-22 17:27:13 +05:30
package headers
import (
"net/http/httptest"
"testing"
"github.com/stretchr/testify/require"
)
func TestIsDetectContentTypeHeaderPresent(t *testing.T) {
rw := httptest.NewRecorder()
rw.Header().Del(GitlabWorkhorseDetectContentTypeHeader)
require.Equal(t, false, IsDetectContentTypeHeaderPresent(rw))
rw.Header().Set(GitlabWorkhorseDetectContentTypeHeader, "true")
require.Equal(t, true, IsDetectContentTypeHeaderPresent(rw))
rw.Header().Set(GitlabWorkhorseDetectContentTypeHeader, "false")
require.Equal(t, false, IsDetectContentTypeHeaderPresent(rw))
rw.Header().Set(GitlabWorkhorseDetectContentTypeHeader, "foobar")
require.Equal(t, false, IsDetectContentTypeHeaderPresent(rw))
}