MCPcopy
hub / github.com/larksuite/cli / TestInterceptor_MCP_TAT

Function TestInterceptor_MCP_TAT

extension/transport/sidecar/interceptor_test.go:175–189  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestInterceptor_MCP_TAT(t *testing.T) {
176 interceptor := &Interceptor{key: []byte("key"), sidecarHost: "127.0.0.1:16384"}
177
178 req, _ := http.NewRequest("POST", "https://mcp.feishu.cn/mcp/v1/tools/call", bytes.NewReader([]byte(`{}`)))
179 req.Header.Set(sidecar.HeaderMCPTAT, sidecar.SentinelTAT)
180
181 interceptor.PreRoundTrip(req)
182
183 if identity := req.Header.Get(sidecar.HeaderProxyIdentity); identity != sidecar.IdentityBot {
184 t.Errorf("identity = %q, want %q", identity, sidecar.IdentityBot)
185 }
186 if ah := req.Header.Get(sidecar.HeaderProxyAuthHeader); ah != sidecar.HeaderMCPTAT {
187 t.Errorf("auth header = %q, want %q", ah, sidecar.HeaderMCPTAT)
188 }
189}
190
191func TestInterceptor_StandardAuth_SetsAuthorizationHeader(t *testing.T) {
192 interceptor := &Interceptor{key: []byte("key"), sidecarHost: "127.0.0.1:16384"}

Callers

nothing calls this directly

Calls 3

PreRoundTripMethod · 0.95
SetMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected