MCPcopy
hub / github.com/dosco/graphjin / TestApiKeyAuthHeader

Function TestApiKeyAuthHeader

core/openapi/auth_test.go:95–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93}
94
95func TestApiKeyAuthHeader(t *testing.T) {
96 p, _ := NewAuthProvider(AuthConfig{
97 Scheme: "api_key",
98 KeyName: "X-API-Key",
99 KeyValue: "secret",
100 KeyIn: "header",
101 }, nil)
102 req := newTestRequest(t, "https://x")
103 _ = p.Apply(context.Background(), req, nil)
104 if got := req.Header.Get("X-API-Key"); got != "secret" {
105 t.Errorf("X-API-Key = %q", got)
106 }
107}
108
109func TestApiKeyAuthQuery(t *testing.T) {
110 p, _ := NewAuthProvider(AuthConfig{

Callers

nothing calls this directly

Calls 4

ApplyMethod · 0.95
NewAuthProviderFunction · 0.85
newTestRequestFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected