feat: migration from axios to fetch #42
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As part of my work on ActivityWatch/aw-watcher-web#103, a need to switch from Axios (based on XMLHTTPRequest) to native fetch arose due to the removal of XMLHTTPRequest in Service Workers. These are a requirement for Manifest V3 with Manifest V2 being removed from Chrome soon (see).
Notably, Node.JS gained support for fetch by default in v18 with v16 introducing it via the
--experimental-fetch
flag. According to the release schedule found here, v16 has been moved to maintenance and will reach end of life on September 11th. Unfortunately, this means that this PR would break support for a maintenance release of Node in the meantime. Users of v16 could either enable support for fetch or use one of the many polyfills.This PR also removes the
timeout
option which, if implemented, would involve using aPromise.race
andAbortController
although I'd be curious if this option is in use. I'm willing to implement it if desired!