MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / configureClientAuth

Function configureClientAuth

lib/auth.ts:15–37  ·  view source on GitHub ↗
(client: any)

Source from the content-addressed store, hash-verified

13}
14
15export function configureClientAuth(client: any): any {
16 const authHeader = getAuthorizationHeader()
17
18 if (!authHeader) {
19 return client
20 }
21
22 // The SDK client has an internal client with request interceptors
23 // Access the underlying client to add the interceptor
24 const innerClient = client._client || client.client
25
26 if (innerClient?.interceptors?.request) {
27 innerClient.interceptors.request.use((request: Request) => {
28 // Only add auth header if not already present
29 if (!request.headers.has("Authorization")) {
30 request.headers.set("Authorization", authHeader)
31 }
32 return request
33 })
34 }
35
36 return client
37}

Callers 1

index.tsFile · 0.90

Calls 1

getAuthorizationHeaderFunction · 0.85

Tested by

no test coverage detected