suhaotian / xior

A lite request lib based on fetch with plugin support and similar API to axios.
https://suhaotian.github.io/xior/
MIT License
193 stars 4 forks source link

More plugins and umd support: support mock, error cache, requests dedupe plugins and UMD output #8

Closed suhaotian closed 8 months ago

suhaotian commented 8 months ago

Mock plugin inspired from:

https://github.com/ctimmerm/axios-mock-adapter

It's very useful when do testing or mock backend API without real backend.

TODOs:


The error cache plugin is when the GET data API wrong but have cache, don't throw error, use the cache data, And you can know the data is from the cache by fromCache: boolean.

It's different with cache plugin: cache plugin if have cache data then use the cache data, if request error, throw error


Dedupe plugin support

Let people just load xior in the browser.