(status: number, headers: Headers)
| 81 | const GIST_FETCH_TIMEOUT_MS = 15_000 |
| 82 | |
| 83 | function getGistRequestErrorMessage(status: number, headers: Headers): string { |
| 84 | if (status === 403 && headers.get('x-ratelimit-remaining') === '0') { |
| 85 | return 'GitHub Gist rate limit reached. Try again later.' |
| 86 | } |
| 87 | |
| 88 | if (status === 401 || status === 403) { |
| 89 | return 'GitHub Gist import supports public Gists only; private or rate-limited Gists require authentication' |
| 90 | } |
| 91 | |
| 92 | if (status === 404) { |
| 93 | return 'GitHub Gist was not found or is not public' |
| 94 | } |
| 95 | |
| 96 | return `GitHub Gist request failed with status ${status}` |
| 97 | } |
| 98 | |
| 99 | export function parseGitHubGistResponse( |
| 100 | gist: GitHubGistResponse, |
no test coverage detected