Class Axios

Description

Axios OOP static interface

Features:

  • OOP
  • DI

Example

import { Axios } from '@biorate/axios';

class Yandex extends Axios {
public baseURL = 'https://yandex.ru';
}

(async () => {
const response = await Yandex.fetch<string>();
console.log(response.status); // 200
console.log(response.data); // <!DOCTYPE html><html ...
})();

Hierarchy

Constructors

Properties

#client: AxiosInstance

Description

Axios client cache

cache: WeakMap<typeof Axios, Axios> = ...

Description

Axios instance cache

mocks: WeakMap<typeof Axios, {
    value: boolean;
}> = ...

Type declaration

  • value: boolean

Description

Axios instance cache

stubs: WeakMap<typeof Axios, ((options?) => Promise<AxiosResponse<any, any>>)> = ...

Type declaration

Description

Stubs instance cache

Accessors

Methods

  • Parameters

    • params: {
          config?: Record<string, any>;
          data: string | Record<string, any>;
          error?: Error;
          headers?: Record<string, any>;
          status?: number;
          statusText?: string;
      }
      • Optional config?: Record<string, any>
      • data: string | Record<string, any>
      • Optional error?: Error
      • Optional headers?: Record<string, any>
      • Optional status?: number
      • Optional statusText?: string
    • persist: boolean = false

    Returns void

    Description

    Stub static method

Generated using TypeDoc