( response: Response, )
| 11 | * 401s. Returns undefined for the generic `"unauthorized"` body so callers can |
| 12 | * distinguish a server-supplied detail from a routine 401. */ |
| 13 | export const readAuthErrorDetail = async ( |
| 14 | response: Response, |
| 15 | ): Promise<string | undefined> => { |
| 16 | try { |
| 17 | const body = (await response.clone().text()).trim(); |
| 18 | if (!body || body === "unauthorized") return undefined; |
| 19 | return body; |
| 20 | } catch { |
| 21 | return undefined; |
| 22 | } |
| 23 | }; |
no test coverage detected