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

request_test.go « request « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1f47ee2e61c9b281cd67e878103e3257c3a2ed79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package request

import (
	"net/http"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestWithHTTPSFlag(t *testing.T) {
	r, err := http.NewRequest("GET", "/", nil)
	require.NoError(t, err)

	assert.Panics(t, func() {
		IsHTTPS(r)
	})

	httpsRequest := WithHTTPSFlag(r, true)
	assert.True(t, IsHTTPS(httpsRequest))

	httpRequest := WithHTTPSFlag(r, false)
	assert.False(t, IsHTTPS(httpRequest))
}