(response: Response)
| 309 | }; |
| 310 | |
| 311 | const bodyPreviewFromResponse = async (response: Response): Promise<string | undefined> => { |
| 312 | const text = await Promise.resolve() |
| 313 | .then(() => response.clone().text()) |
| 314 | .then( |
| 315 | (value) => value.trim(), |
| 316 | () => "", |
| 317 | ); |
| 318 | if (!text) return undefined; |
| 319 | const redacted = redactTokenEndpointBody(text.replaceAll(/\s+/g, " ")); |
| 320 | return redacted.length > 500 ? `${redacted.slice(0, 500)}...` : redacted; |
| 321 | }; |
| 322 | |
| 323 | const toOAuth2Error = (cause: unknown): OAuth2Error => { |
| 324 | if (isOAuth2Error(cause)) return cause; |
no test coverage detected