MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / withAuth

Function withAuth

packages/server/test/helpers/serverHarness.ts:62–68  ·  view source on GitHub ↗
(init: RequestInit = {}, token: string = DEFAULT_TOKEN)

Source from the content-addressed store, hash-verified

60 * need to send a wrong/no token can still do so explicitly.
61 */
62export function withAuth(init: RequestInit = {}, token: string = DEFAULT_TOKEN): RequestInit {
63 const headers = new Headers(init.headers);
64 if (!headers.has('Authorization')) {
65 headers.set('Authorization', `Bearer ${token}`);
66 }
67 return { ...init, headers };
68}
69
70/**
71 * WS subprotocol prefix that carries the bearer token during the upgrade.

Callers 6

postSessionFunction · 0.90
fetchSnapshotFunction · 0.90
postSessionFunction · 0.90
timeSnapshotFunction · 0.90
generateMethod · 0.85
createVideoUploaderMethod · 0.85

Calls 2

hasMethod · 0.65
setMethod · 0.65

Tested by 4

postSessionFunction · 0.72
fetchSnapshotFunction · 0.72
postSessionFunction · 0.72
timeSnapshotFunction · 0.72