MCPcopy Create free account
hub / github.com/tiann/hapi / tryOnce

Method tryOnce

web/src/api/client.ts:445–453  ·  view source on GitHub ↗
(overrideToken: string | null)

Source from the content-addressed store, hash-verified

443 async migrateCursorSessionToAcp(sessionId: string, body: CursorMigrateToAcpRequest = {}): Promise<CursorMigrateOutcome> {
444 const path = `/api/sessions/${encodeURIComponent(sessionId)}/migrate-to-acp`
445 const tryOnce = async (overrideToken: string | null): Promise<Response> => {
446 const headers = new Headers({ 'content-type': 'application/json' })
447 const liveToken = this.getToken ? this.getToken() : null
448 const authToken = overrideToken ?? liveToken ?? this.token
449 if (authToken) {
450 headers.set('authorization', `Bearer ${authToken}`)
451 }
452 return fetch(this.buildUrl(path), { method: 'POST', headers, body: JSON.stringify(body) })
453 }
454
455 let res = await tryOnce(null)
456 if (res.status === 401 && this.onUnauthorized) {

Callers

nothing calls this directly

Calls 1

buildUrlMethod · 0.95

Tested by

no test coverage detected