iamnbutler/shelfgoblinPublic

Shelf Goblin — discover LitRPG audiobooks, follow series, and track your library.

Add shared HTTP client with timeout, retry, and rate limiting

Create scripts/backend/http.ts with:
- Configurable request timeout via AbortSignal.timeout()
- Retry with exponential backoff + jitter on 429/5xx/network errors
- Per-host rate limiting with configurable minimum delay
- Request logging to stderr with status, duration, and attempt number
- Typed responses with HttpError for non-2xx failures

Add vitest and 14 unit tests covering all error handling paths.

Closes #24

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
C4TATasks Agent and Claude Opus 4.6 authored committed by iamnbutler
2c2c784Patch
Parentce4c441
4 files changed+740-3
StackedSplit
package-lock.json+349 −1
package.json+5 −2
scripts/backend/http.test.ts+186 −0
scripts/backend/http.ts+200 −0