(status: number, body?: string)
| 62 | } |
| 63 | |
| 64 | function errorResponse(status: number, body?: string) { |
| 65 | return { |
| 66 | status, |
| 67 | ok: false, |
| 68 | headers: new Headers({ 'Content-Type': 'application/json' }), |
| 69 | text: async () => body || '{}', |
| 70 | json: async () => JSON.parse(body || '{}'), |
| 71 | } as Response; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Convenience: create a two-phase mock (device/code → token polling). |