typesense-js
typesense-js copied to clipboard
feat: Switch from axios to fetch
Change Summary
Since Cloudflare workers and Vercel Edge runtimes does not support Axios, the intent here is to switch to native fetch (which has been supported since Node v18.0.0). This should probably be a major bump, but trying not to break contracts as much as possible.
Fixes #161
Investigations needed
- [ ] check crypto, http and https support on edge enviromnets
- [ ] creating a pluggable http client, so we could in theory pass axios, or fetch
- [ ] keep alive wont work in edge, maybe add a typeguard for this?
- [ ] make tests pass
- [ ] multiple runtimes during tests? e.g node edge etc
Changes
- I needed to write a wrapper on fetch, called FetchWithTimeout to support connectionTimeout. Added a new folder called Shared, not sure that is correct but it is not tied to Typesense in that manner.
PR Checklist
- [x] I have read and signed the Contributor License Agreement.