axios

  • Version 0.22.0
  • Published
  • 385 kB
  • 1 dependency
  • MIT license

Install

npm i axios
yarn add axios
pnpm add axios

Overview

Promise based HTTP client for the browser and node.js

Index

Variables

variable axios

const axios: AxiosStatic;

    Classes

    class Axios

    class Axios {}

      constructor

      constructor(config?: AxiosRequestConfig<any>);

        property defaults

        defaults: AxiosRequestConfig<any>;

          property interceptors

          interceptors: {
          request: AxiosInterceptorManager<AxiosRequestConfig>;
          response: AxiosInterceptorManager<AxiosResponse>;
          };

            method delete

            delete: <T = never, R = AxiosResponse<T>>(
            url: string,
            config?: AxiosRequestConfig<T>
            ) => Promise<R>;

              method get

              get: <T = never, R = AxiosResponse<T>>(
              url: string,
              config?: AxiosRequestConfig<T>
              ) => Promise<R>;

                method getUri

                getUri: (config?: AxiosRequestConfig) => string;

                  method head

                  head: <T = never, R = AxiosResponse<T>>(
                  url: string,
                  config?: AxiosRequestConfig<T>
                  ) => Promise<R>;

                    method options

                    options: <T = never, R = AxiosResponse<T>>(
                    url: string,
                    config?: AxiosRequestConfig<T>
                    ) => Promise<R>;

                      method patch

                      patch: <T = never, R = AxiosResponse<T>>(
                      url: string,
                      data?: T,
                      config?: AxiosRequestConfig<T>
                      ) => Promise<R>;

                        method post

                        post: <T = never, R = AxiosResponse<T>>(
                        url: string,
                        data?: T,
                        config?: AxiosRequestConfig<T>
                        ) => Promise<R>;

                          method put

                          put: <T = never, R = AxiosResponse<T>>(
                          url: string,
                          data?: T,
                          config?: AxiosRequestConfig<T>
                          ) => Promise<R>;

                            method request

                            request: <T = never, R = AxiosResponse<T>>(
                            config: AxiosRequestConfig<T>
                            ) => Promise<R>;

                              Interfaces

                              interface AxiosAdapter

                              interface AxiosAdapter {}

                                call signature

                                (config: AxiosRequestConfig): AxiosPromise<any>;

                                  interface AxiosBasicCredentials

                                  interface AxiosBasicCredentials {}

                                    property password

                                    password: string;

                                      property username

                                      username: string;

                                        interface AxiosError

                                        interface AxiosError<T = never> extends Error {}

                                          property code

                                          code?: string;

                                            property config

                                            config: AxiosRequestConfig;

                                              property isAxiosError

                                              isAxiosError: boolean;

                                                property request

                                                request?: any;

                                                  property response

                                                  response?: AxiosResponse<T>;

                                                    property toJSON

                                                    toJSON: () => object;

                                                      interface AxiosInstance

                                                      interface AxiosInstance extends Axios {}

                                                        call signature

                                                        (config: AxiosRequestConfig): AxiosPromise;

                                                          call signature

                                                          (url: string, config?: AxiosRequestConfig): AxiosPromise;

                                                            interface AxiosInterceptorManager

                                                            interface AxiosInterceptorManager<V> {}

                                                              method eject

                                                              eject: (id: number) => void;

                                                                method use

                                                                use: <T = V>(
                                                                onFulfilled?: (value: V) => T | Promise<T>,
                                                                onRejected?: (error: any) => any
                                                                ) => number;

                                                                  interface AxiosPromise

                                                                  interface AxiosPromise<T = never> extends Promise<AxiosResponse<T>> {}

                                                                    interface AxiosProxyConfig

                                                                    interface AxiosProxyConfig {}

                                                                      property auth

                                                                      auth?: {
                                                                      username: string;
                                                                      password: string;
                                                                      };

                                                                        property host

                                                                        host: string;

                                                                          property port

                                                                          port: number;

                                                                            property protocol

                                                                            protocol?: string;

                                                                              interface AxiosRequestConfig

                                                                              interface AxiosRequestConfig<T = any> {}

                                                                                property adapter

                                                                                adapter?: AxiosAdapter;

                                                                                  property auth

                                                                                  auth?: AxiosBasicCredentials;

                                                                                    property baseURL

                                                                                    baseURL?: string;

                                                                                      property cancelToken

                                                                                      cancelToken?: CancelToken;

                                                                                        property data

                                                                                        data?: T;

                                                                                          property decompress

                                                                                          decompress?: boolean;

                                                                                            property headers

                                                                                            headers?: Record<string, string>;

                                                                                              property httpAgent

                                                                                              httpAgent?: any;

                                                                                                property httpsAgent

                                                                                                httpsAgent?: any;

                                                                                                  property maxBodyLength

                                                                                                  maxBodyLength?: number;

                                                                                                    property maxContentLength

                                                                                                    maxContentLength?: number;

                                                                                                      property maxRedirects

                                                                                                      maxRedirects?: number;

                                                                                                        property method

                                                                                                        method?: Method;

                                                                                                          property onDownloadProgress

                                                                                                          onDownloadProgress?: (progressEvent: any) => void;

                                                                                                            property onUploadProgress

                                                                                                            onUploadProgress?: (progressEvent: any) => void;

                                                                                                              property params

                                                                                                              params?: any;

                                                                                                                property paramsSerializer

                                                                                                                paramsSerializer?: (params: any) => string;

                                                                                                                  property proxy

                                                                                                                  proxy?: AxiosProxyConfig | false;

                                                                                                                    property responseType

                                                                                                                    responseType?: ResponseType;

                                                                                                                      property signal

                                                                                                                      signal?: AbortSignal;

                                                                                                                        property socketPath

                                                                                                                        socketPath?: string | null;

                                                                                                                          property timeout

                                                                                                                          timeout?: number;

                                                                                                                            property timeoutErrorMessage

                                                                                                                            timeoutErrorMessage?: string;

                                                                                                                              property transformRequest

                                                                                                                              transformRequest?: AxiosTransformer | AxiosTransformer[];

                                                                                                                                property transformResponse

                                                                                                                                transformResponse?: AxiosTransformer | AxiosTransformer[];

                                                                                                                                  property transitional

                                                                                                                                  transitional?: TransitionalOptions;

                                                                                                                                    property url

                                                                                                                                    url?: string;

                                                                                                                                      property validateStatus

                                                                                                                                      validateStatus?: ((status: number) => boolean) | null;

                                                                                                                                        property withCredentials

                                                                                                                                        withCredentials?: boolean;

                                                                                                                                          property xsrfCookieName

                                                                                                                                          xsrfCookieName?: string;

                                                                                                                                            property xsrfHeaderName

                                                                                                                                            xsrfHeaderName?: string;

                                                                                                                                              interface AxiosResponse

                                                                                                                                              interface AxiosResponse<T = never> {}

                                                                                                                                                property config

                                                                                                                                                config: AxiosRequestConfig<T>;

                                                                                                                                                  property data

                                                                                                                                                  data: T;

                                                                                                                                                    property headers

                                                                                                                                                    headers: Record<string, string>;

                                                                                                                                                      property request

                                                                                                                                                      request?: any;

                                                                                                                                                        property status

                                                                                                                                                        status: number;

                                                                                                                                                          property statusText

                                                                                                                                                          statusText: string;

                                                                                                                                                            interface AxiosStatic

                                                                                                                                                            interface AxiosStatic extends AxiosInstance {}

                                                                                                                                                              property Axios

                                                                                                                                                              Axios: typeof Axios;

                                                                                                                                                                property Cancel

                                                                                                                                                                Cancel: CancelStatic;

                                                                                                                                                                  property CancelToken

                                                                                                                                                                  CancelToken: CancelTokenStatic;

                                                                                                                                                                    property VERSION

                                                                                                                                                                    readonly VERSION: string;

                                                                                                                                                                      method all

                                                                                                                                                                      all: <T>(values: (T | Promise<T>)[]) => Promise<T[]>;

                                                                                                                                                                        method create

                                                                                                                                                                        create: (config?: AxiosRequestConfig) => AxiosInstance;

                                                                                                                                                                          method isAxiosError

                                                                                                                                                                          isAxiosError: (payload: any) => payload is AxiosError<never>;

                                                                                                                                                                            method isCancel

                                                                                                                                                                            isCancel: (value: any) => boolean;

                                                                                                                                                                              method spread

                                                                                                                                                                              spread: <T, R>(callback: (...args: T[]) => R) => (array: T[]) => R;

                                                                                                                                                                                interface AxiosTransformer

                                                                                                                                                                                interface AxiosTransformer {}

                                                                                                                                                                                  call signature

                                                                                                                                                                                  (data: any, headers?: Record<string, string>): any;

                                                                                                                                                                                    interface Cancel

                                                                                                                                                                                    interface Cancel {}

                                                                                                                                                                                      property message

                                                                                                                                                                                      message: string;

                                                                                                                                                                                        interface Canceler

                                                                                                                                                                                        interface Canceler {}

                                                                                                                                                                                          call signature

                                                                                                                                                                                          (message?: string): void;

                                                                                                                                                                                            interface CancelStatic

                                                                                                                                                                                            interface CancelStatic {}

                                                                                                                                                                                              construct signature

                                                                                                                                                                                              new (message?: string): Cancel;

                                                                                                                                                                                                interface CancelToken

                                                                                                                                                                                                interface CancelToken {}

                                                                                                                                                                                                  property promise

                                                                                                                                                                                                  promise: Promise<Cancel>;

                                                                                                                                                                                                    property reason

                                                                                                                                                                                                    reason?: Cancel;

                                                                                                                                                                                                      method throwIfRequested

                                                                                                                                                                                                      throwIfRequested: () => void;

                                                                                                                                                                                                        interface CancelTokenSource

                                                                                                                                                                                                        interface CancelTokenSource {}

                                                                                                                                                                                                          property cancel

                                                                                                                                                                                                          cancel: Canceler;

                                                                                                                                                                                                            property token

                                                                                                                                                                                                            token: CancelToken;

                                                                                                                                                                                                              interface CancelTokenStatic

                                                                                                                                                                                                              interface CancelTokenStatic {}

                                                                                                                                                                                                                method source

                                                                                                                                                                                                                source: () => CancelTokenSource;

                                                                                                                                                                                                                  construct signature

                                                                                                                                                                                                                  new (executor: (cancel: Canceler) => void): CancelToken;

                                                                                                                                                                                                                    interface TransitionalOptions

                                                                                                                                                                                                                    interface TransitionalOptions {}

                                                                                                                                                                                                                      property clarifyTimeoutError

                                                                                                                                                                                                                      clarifyTimeoutError: boolean;

                                                                                                                                                                                                                        property forcedJSONParsing

                                                                                                                                                                                                                        forcedJSONParsing: boolean;

                                                                                                                                                                                                                          property silentJSONParsing

                                                                                                                                                                                                                          silentJSONParsing: boolean;

                                                                                                                                                                                                                            Type Aliases

                                                                                                                                                                                                                            type Method

                                                                                                                                                                                                                            type Method =
                                                                                                                                                                                                                            | 'get'
                                                                                                                                                                                                                            | 'GET'
                                                                                                                                                                                                                            | 'delete'
                                                                                                                                                                                                                            | 'DELETE'
                                                                                                                                                                                                                            | 'head'
                                                                                                                                                                                                                            | 'HEAD'
                                                                                                                                                                                                                            | 'options'
                                                                                                                                                                                                                            | 'OPTIONS'
                                                                                                                                                                                                                            | 'post'
                                                                                                                                                                                                                            | 'POST'
                                                                                                                                                                                                                            | 'put'
                                                                                                                                                                                                                            | 'PUT'
                                                                                                                                                                                                                            | 'patch'
                                                                                                                                                                                                                            | 'PATCH'
                                                                                                                                                                                                                            | 'purge'
                                                                                                                                                                                                                            | 'PURGE'
                                                                                                                                                                                                                            | 'link'
                                                                                                                                                                                                                            | 'LINK'
                                                                                                                                                                                                                            | 'unlink'
                                                                                                                                                                                                                            | 'UNLINK';

                                                                                                                                                                                                                              type ResponseType

                                                                                                                                                                                                                              type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';

                                                                                                                                                                                                                                Package Files (1)

                                                                                                                                                                                                                                Dependencies (1)

                                                                                                                                                                                                                                Dev Dependencies (34)

                                                                                                                                                                                                                                Peer Dependencies (0)

                                                                                                                                                                                                                                No peer dependencies.

                                                                                                                                                                                                                                Badge

                                                                                                                                                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/axios.

                                                                                                                                                                                                                                • Markdown
                                                                                                                                                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/axios)
                                                                                                                                                                                                                                • HTML
                                                                                                                                                                                                                                  <a href="https://www.jsdocs.io/package/axios"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>