MCPcopy Create free account
hub / github.com/ding113/claude-code-hub / createClaudeCodeSession

Function createClaudeCodeSession

tests/unit/proxy/client-guard.test.ts:41–59  ·  view source on GitHub ↗
(
  userAgent: string,
  allowedClients: string[] = [],
  blockedClients: string[] = [],
  betaHeader = "claude-code-test",
  metadataUserId = LEGACY_METADATA_USER_ID
)

Source from the content-addressed store, hash-verified

39
40// Helper for fully-confirmed Claude Code CLI sessions (all 4 signals)
41function createClaudeCodeSession(
42 userAgent: string,
43 allowedClients: string[] = [],
44 blockedClients: string[] = [],
45 betaHeader = "claude-code-test",
46 metadataUserId = LEGACY_METADATA_USER_ID
47): ProxySession {
48 const headers = new Headers();
49 headers.set("x-app", "cli");
50 headers.set("anthropic-beta", betaHeader);
51 return {
52 userAgent,
53 headers,
54 request: { message: { metadata: { user_id: metadataUserId } } },
55 authState: {
56 user: { allowedClients, blockedClients },
57 },
58 } as unknown as ProxySession;
59}
60
61describe("ProxyClientGuard", () => {
62 describe("when authState is missing", () => {

Callers 1

Calls 1

setMethod · 0.65

Tested by

no test coverage detected