axios

  • Version 0.21.1
  • Published
  • 371 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;

    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 = any> 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 {}

                              property defaults

                              defaults: AxiosRequestConfig;

                                property interceptors

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

                                  method delete

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

                                    method get

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

                                      method getUri

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

                                        method head

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

                                          method options

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

                                            method patch

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

                                              method post

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

                                                method put

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

                                                  method request

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

                                                    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: (
                                                            onFulfilled?: (value: V) => V | Promise<V>,
                                                            onRejected?: (error: any) => any
                                                            ) => number;

                                                              interface AxiosPromise

                                                              interface AxiosPromise<T = any> 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 {}

                                                                            property adapter

                                                                            adapter?: AxiosAdapter;

                                                                              property auth

                                                                              auth?: AxiosBasicCredentials;

                                                                                property baseURL

                                                                                baseURL?: string;

                                                                                  property cancelToken

                                                                                  cancelToken?: CancelToken;

                                                                                    property data

                                                                                    data?: any;

                                                                                      property decompress

                                                                                      decompress?: boolean;

                                                                                        property headers

                                                                                        headers?: any;

                                                                                          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 socketPath

                                                                                                                  socketPath?: string | null;

                                                                                                                    property timeout

                                                                                                                    timeout?: number;

                                                                                                                      property timeoutErrorMessage

                                                                                                                      timeoutErrorMessage?: string;

                                                                                                                        property transformRequest

                                                                                                                        transformRequest?: AxiosTransformer | AxiosTransformer[];

                                                                                                                          property transformResponse

                                                                                                                          transformResponse?: AxiosTransformer | AxiosTransformer[];

                                                                                                                            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 = any> {}

                                                                                                                                        property config

                                                                                                                                        config: AxiosRequestConfig;

                                                                                                                                          property data

                                                                                                                                          data: T;

                                                                                                                                            property headers

                                                                                                                                            headers: any;

                                                                                                                                              property request

                                                                                                                                              request?: any;

                                                                                                                                                property status

                                                                                                                                                status: number;

                                                                                                                                                  property statusText

                                                                                                                                                  statusText: string;

                                                                                                                                                    interface AxiosStatic

                                                                                                                                                    interface AxiosStatic extends AxiosInstance {}

                                                                                                                                                      property Cancel

                                                                                                                                                      Cancel: CancelStatic;

                                                                                                                                                        property CancelToken

                                                                                                                                                        CancelToken: CancelTokenStatic;

                                                                                                                                                          method all

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

                                                                                                                                                            method create

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

                                                                                                                                                              method isAxiosError

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

                                                                                                                                                                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?: any): 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;

                                                                                                                                                                                                        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 (35)

                                                                                                                                                                                                            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>