suhaotian / xior

A lite request lib based on fetch with plugin support and similar API to axios.
https://www.npmjs.com/package/xior
MIT License
114 stars 1 forks source link

Current interceptor chains are not compatible with Axios interceptors #15

Closed mgoodfellow closed 2 months ago

mgoodfellow commented 2 months ago

See: https://github.com/axios/axios?tab=readme-ov-file#multiple-interceptors

Currently with xior - if the response interceptor throws, the chain ends: https://github.com/suhaotian/xior/blob/main/src/xior.ts#L239

I think it would be ideal to follow the same logic that axios uses to aid with drop-in replacements. In the case of the xior-auth-refresh plugin, I've noticed that any subsequent response error interceptors won't run.

suhaotian commented 2 months ago

I see, will fix in next version Thanks feedback!!   🙌

suhaotian commented 2 months ago

Merged then the issue automatic closed! (well done, github!)

mgoodfellow commented 2 months ago

Great thanks so much for this!

mgoodfellow commented 2 months ago

Fully validated, so pushed an updated version of the auth plugin which makes sure this version is used so avoid any unexpected behaviour!

Once again, thanks so much for the incredible turnaround - this library has been a lifesaver!

suhaotian commented 2 months ago

Cool, Thanks! @mgoodfellow 🙌