developit / redaxios

The Axios API, as an 800 byte Fetch wrapper.
https://npm.im/redaxios
Apache License 2.0
4.67k stars 100 forks source link

Does redaxios support adaptor? #98

Open guoyunhe opened 5 months ago

guoyunhe commented 5 months ago

In iOS, POST body might be abandoned by the WKWebView. So in my project, we expose an different method for sending POST request. With axios, we can use adaptor to replace xhr in iOS. Does redaxios support the same feature?

{
  // `adapter` allows custom handling of requests which makes testing easier.
  // Return a promise and supply a valid response (see lib/adapters/README.md).
  adapter: function (config) {
    /* ... */
  },
}
suhaotian commented 5 months ago

Do you want try xior.js? You can easily create adapter: https://github.com/suhaotian/xior?tab=readme-ov-file#create-your-own-custom-plugin

Any issues free to ask, thanks :)

BTW, redaxios use fetch if didn't use polyfill, not XHR.

guoyunhe commented 4 months ago

@suhaotian good, i will try!