Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xior

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xior - npm Package Versions

1345

0.4.1

Diff

Changelog

Source

v0.4.1 2024/04/29

  • Feat: remove undefined value in params / data
suhaotian
published 0.4.0 •

Changelog

Source

v0.4.0 2024/04/24

Breaking Change

This version is about Axios compatible issue in some cases. Fixing https://github.com/suhaotian/xior/issues/12 and https://github.com/suhaotian/xior/issues/15.

  • Feat(core): when responseType: 'blob' | 'arrarybuffer' then the resposne.data is Blob and ArrayBuffer, no need response.blob() or response.arraybuffer() anymore.
  • Fix(interceptors): make sure the multiple response interceptors chain behaviour same as axios's interceptors.
suhaotian
published 0.3.13 •

Changelog

Source

v0.3.13 2024/04/21

  • Feat(plugin): add custom paramaters of LRU in plugins: cache, error-cache, throttle
  • Feat(plugin): add cacheTime to cache plugin
suhaotian
published 0.3.12 •

Changelog

Source

v0.3.12 2024/04/13

  • fix(plugin): fix error cache plugin cacheTime is undefined when useCacheFirst: true
suhaotian
published 0.3.11 •

Changelog

Source

v0.3.11 2024/04/12

  • feat(plugin): error-cache plugin add cacheTime to the response
suhaotian
published 0.3.10 •

Changelog

Source

v0.3.10 2024/04/11

  • feat(plugin): error-retry plugin's retryInterval add config and error to parameters
suhaotian
published 0.3.9 •

Changelog

Source

v0.3.9 2024/04/9

  • feat(core): add try catch to await fetch(...)

Now you can capture the request error in response interceptors, and the error will be TypeError:

import xior, { merge } from 'xior';

const http = xior.create({
  // ...options
});

http.interceptors.response.use(
  (result) => {
    return result;
  },
  async (error) => {
    if (error instanceof TypeError) {
      console.log(`Request error:`, error);
    }
    if (error?.response?.status === 401) {
      localStorage.removeItem('REQUEST_TOKEN');
    }
  }
);
suhaotian
published 0.3.8 •

Changelog

Source

v0.3.8 2024/04/8

  • feat(plugins): enhance plugins's enable* logic

Now you can return undefined in enable* method:

import xior from 'xior';
import errorRetryPlugin from 'xior/plugins/error-retry';

const http = xior.create();
http.plugins.use(
  errorRetryPlugin({
    enableRetry(config, error) {
      if (error.response?.status === 401) {
        return false;
      }
      // no return here, and will reuse the default `enableRetry` logic
    },
  })
);
suhaotian
published 0.3.7 •

Changelog

Source

v0.3.7 2024/04/7

  • feat(plugin): add useCacheFirst to error cache plugin

If useCacheFirst: true and there's a cache, it will return the cached response first, then run fetching in the background. This is useful when the response takes a long time, and the data is unnecessary in real-time.

suhaotian
published 0.3.6 •

Changelog

Source

v0.3.6 2024/04/6

  • feat(plugin): add onThrottle to throttle plugin for logging purpose
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc