(response: Response)
| 141 | }); |
| 142 | |
| 143 | const readJson = async (response: Response): Promise<Record<string, unknown>> => { |
| 144 | const text = await response.text(); |
| 145 | if (!text) return {}; |
| 146 | try { |
| 147 | return JSON.parse(text) as Record<string, unknown>; |
| 148 | } catch { |
| 149 | return { error: "invalid_response", error_description: text.slice(0, 200) }; |
| 150 | } |
| 151 | }; |
| 152 | |
| 153 | export const discoverCliLogin = async (origin: string): Promise<CliLoginDiscovery> => { |
| 154 | let response: Response; |
no test coverage detected