Skip to content

Replace axios with native fetch#108

Open
DavidDuwaer wants to merge 1 commit into
masterfrom
remove-axios-use-fetch
Open

Replace axios with native fetch#108
DavidDuwaer wants to merge 1 commit into
masterfrom
remove-axios-use-fetch

Conversation

@DavidDuwaer
Copy link
Copy Markdown
Owner

Summary

  • Adds FetchHttpClient, FetchHttpClientPromise, FetchHttpClientResponse backed by the native fetch API — no third-party HTTP dependency
  • The three Axios* classes in src/httpclient/axios/ now re-export their Fetch* counterparts, so any consumer code that imports AxiosHttpClient / AxiosHttpClientResponse / AxiosHttpClientPromise by name continues to work unchanged
  • FetchHttpClient is now the default client used by Model (previously AxiosHttpClient)
  • FetchHttpClient.getImplementingClient() returns this; its .defaults.headers object is mutable, replicating the pattern used to set custom headers on the old axios instance
  • Drops moxios and @types/moxios from devDependencies; replaces them with a lightweight tests/support/fetchMock.ts helper that exposes the same install / uninstall / wait / requests API surface so every test stays structurally identical

Test plan

  • npm test passes all 98 tests locally (Builder, Model1, Model2, Relation, RetrievalResponse, Query, Model suites)
  • Verify no axios or moxios references remain in src/ or test fixtures
  • Confirm AxiosHttpClient import still resolves (backwards-compat re-export)

🤖 Generated with Claude Code

- Add FetchHttpClient, FetchHttpClientPromise, FetchHttpClientResponse
- Redirect Axios* exports to their Fetch* counterparts so the public API is unchanged
- Remove axios/AxiosError imports from Builder, Model, and response classes
- Replace moxios test interceptor with a minimal fetchMock helper
- Remove moxios and @types/moxios from devDependencies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant