MCPcopy
hub / github.com/MiniMax-AI/cli / deviceCodeResponse

Function deviceCodeResponse

test/auth/oauth.test.ts:31–47  ·  view source on GitHub ↗

* Build a device/code response whose `state` echoes back the value * extracted from the actual request body — so it always matches.

(reqBody: URLSearchParams, overrides: Record<string, unknown> = {})

Source from the content-addressed store, hash-verified

29 * extracted from the actual request body — so it always matches.
30 */
31function deviceCodeResponse(reqBody: URLSearchParams, overrides: Record<string, unknown> = {}): Response {
32 capturedState = reqBody.get('state');
33 capturedCodeVerifier = reqBody.get('code_verifier') ?? reqBody.get('code_challenge');
34 return {
35 status: 200,
36 ok: true,
37 headers: new Headers({ 'Content-Type': 'application/json' }),
38 json: async () => ({
39 user_code: 'TEST-CODE',
40 verification_uri: 'about:blank',
41 expired_in: Date.now() + 120_000,
42 interval: 10,
43 state: capturedState,
44 ...overrides,
45 }),
46 } as Response;
47}
48
49function tokenResponse(overrides: Record<string, unknown> = {}) {
50 return {

Callers 2

mockDeviceCodeFlowFunction · 0.85
oauth.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected