-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathcookie_test.go
More file actions
43 lines (39 loc) · 911 Bytes
/
cookie_test.go
File metadata and controls
43 lines (39 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package httpapi_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/coder/coder/v2/coderd/httpapi"
)
func TestStripCoderCookies(t *testing.T) {
t.Parallel()
for _, tc := range []struct {
Input string
Output string
}{{
"testing=hello; wow=test",
"testing=hello; wow=test",
}, {
"coder_session_token=moo; wow=test",
"wow=test",
}, {
"another_token=wow; coder_session_token=ok",
"another_token=wow",
}, {
"coder_session_token=ok; oauth_state=wow; oauth_redirect=/",
"",
}, {
"coder_path_app_session_token=ok; wow=test",
"wow=test",
}, {
"coder_subdomain_app_session_token=ok; coder_subdomain_app_session_token_1234567890=ok; wow=test",
"wow=test",
}, {
"coder_signed_app_token=ok; wow=test",
"wow=test",
}} {
t.Run(tc.Input, func(t *testing.T) {
t.Parallel()
require.Equal(t, tc.Output, httpapi.StripCoderCookies(tc.Input))
})
}
}