MCPcopy Index your code
hub / github.com/bytebase/bytebase / TestCustomHeaderFlag

Function TestCustomHeaderFlag

action/command/api_test.go:34–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestCustomHeaderFlag(t *testing.T) {
35 t.Parallel()
36
37 headers := http.Header{}
38 var headerErr error
39 flag := newCustomHeaderFlag(&headers, &headerErr)
40
41 require.NoError(t, flag.Set("Cookie: CF_Authorization=token"))
42 require.NoError(t, flag.Set("X-Request-Id: run-123"))
43 require.NoError(t, headerErr)
44 require.Equal(t, "CF_Authorization=token", headers.Get("Cookie"))
45 require.Equal(t, "run-123", headers.Get("X-Request-Id"))
46}
47
48func TestCustomHeaderFlagRejectsInvalidHeaders(t *testing.T) {
49 t.Parallel()

Callers

nothing calls this directly

Calls 4

newCustomHeaderFlagFunction · 0.85
GetMethod · 0.80
EqualMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected