mirror of
https://github.com/firstsun-dev/git-files-sync.git
synced 2026-07-22 17:20:30 +00:00
Refresh failed with the cryptic "Unexpected token '<', "<!DOCTYPE ..." is not valid JSON" whenever the Git server returned an HTML page (login, SSO redirect, or proxy/error page) on a 2xx/3xx response. safeRequest only threw on status >= 400, so such bodies slipped through and crashed at response.json. Add BaseGitService.parseJson() which detects non-JSON/HTML bodies and throws an actionable message, and use it for all response.json reads in the GitHub and GitLab services. Also harden parseErrorResponse so HTML error pages produce a clear message instead of dumping the raw document. Add tests covering HTML 2xx responses, HTML detection by leading '<', malformed JSON, and HTML error pages. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DwioG4CNKUBuKiZdowLFWe |
||
|---|---|---|
| .. | ||
| git-service-base.test.ts | ||
| github-service.test.ts | ||
| gitlab-service.test.ts | ||
| service-test-helpers.ts | ||