Common interface for Http/Fetch Client
- Dominant language
- TypeScript
- Stars
- 11.7k
- Forks
- 608
- PR merge metrics
- No merged PRs in 30d
Description
**I'm submitting a feature request**
Have you thought of introducing an interface for the Http- and Fetch-client which supports a minimal amount of methods (probably `fetch()` as this is the only one in fetch-client).
I am working with `aurelia-api` which is coupled to the Fetch-Client. I want to make this configurable based on a factory. However, somewhere, I need to call a method of the object from the factory which will be `fetch()`.
Now, what if I want to use the Http-Client library instead of fetch? I could have used an interface in the internal methods of `aurelia-api` which does not rely on a specific implementation.
Making this happen probably only requires introducing one additional method to one of both libs depending on the interface (i.e. `fetch()` to HttpClient or `request()` to Fetch).
Contributor guide
Research direction
Start by comparing the public methods of the Http-Client and Fetch-Client and then trace how aurelia-api obtains its client through a factory. Done means aurelia-api can depend on a minimal common interface while allowing either client implementation, with the interface method choice and required adapter changes documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100