Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpClient

Hierarchy

  • Axios
    • HttpClient

Index

Constructors

  • new HttpClient(config?: AxiosRequestConfig<any>): HttpClient
  • Parameters

    • Optional config: AxiosRequestConfig<any>

    Returns HttpClient

Properties

allowTransformer: boolean = true
defaults: AxiosDefaults<any>
interceptors: { request: AxiosInterceptorManager<AxiosRequestConfig<any>>; response: AxiosInterceptorManager<AxiosResponse<any, any>> }

Type declaration

  • request: AxiosInterceptorManager<AxiosRequestConfig<any>>
  • response: AxiosInterceptorManager<AxiosResponse<any, any>>

Methods

  • delete<T, R, D>(url: string, config?: AxiosRequestConfig<D>): Promise<R>
  • Type parameters

    • T = any

    • R = AxiosResponse<T, any>

    • D = any

    Parameters

    • url: string
    • Optional config: AxiosRequestConfig<D>

    Returns Promise<R>

  • fetch<T, D>(data: D, config?: AxiosRequestConfig<D>): Promise<AxiosResponse<T, D>>
  • 发起请求

    Type parameters

    • T = any

    • D: {} = any

    Parameters

    • data: D

      此字段必须是带有@ApiRequest的class实例

    • config: AxiosRequestConfig<D> = {}

    Returns Promise<AxiosResponse<T, D>>

  • get<T, R, D>(url: string, config?: AxiosRequestConfig<D>): Promise<R>
  • Type parameters

    • T = any

    • R = AxiosResponse<T, any>

    • D = any

    Parameters

    • url: string
    • Optional config: AxiosRequestConfig<D>

    Returns Promise<R>

  • getUri(config?: AxiosRequestConfig<any>): string
  • Parameters

    • Optional config: AxiosRequestConfig<any>

    Returns string

  • head<T, R, D>(url: string, config?: AxiosRequestConfig<D>): Promise<R>
  • Type parameters

    • T = any

    • R = AxiosResponse<T, any>

    • D = any

    Parameters

    • url: string
    • Optional config: AxiosRequestConfig<D>

    Returns Promise<R>

  • options<T, R, D>(url: string, config?: AxiosRequestConfig<D>): Promise<R>
  • Type parameters

    • T = any

    • R = AxiosResponse<T, any>

    • D = any

    Parameters

    • url: string
    • Optional config: AxiosRequestConfig<D>

    Returns Promise<R>

  • patch<T, R, D>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>
  • Type parameters

    • T = any

    • R = AxiosResponse<T, any>

    • D = any

    Parameters

    • url: string
    • Optional data: D
    • Optional config: AxiosRequestConfig<D>

    Returns Promise<R>

  • post<T, R, D>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>
  • Type parameters

    • T = any

    • R = AxiosResponse<T, any>

    • D = any

    Parameters

    • url: string
    • Optional data: D
    • Optional config: AxiosRequestConfig<D>

    Returns Promise<R>

  • put<T, R, D>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>
  • Type parameters

    • T = any

    • R = AxiosResponse<T, any>

    • D = any

    Parameters

    • url: string
    • Optional data: D
    • Optional config: AxiosRequestConfig<D>

    Returns Promise<R>

  • request<T, R, D>(config: AxiosRequestConfig<D>): Promise<R>
  • Type parameters

    • T = any

    • R = AxiosResponse<T, any>

    • D = any

    Parameters

    • config: AxiosRequestConfig<D>

    Returns Promise<R>

  • create(config?: AxiosRequestConfig<any> & { allowTransformer?: boolean }): HttpClient
  • parseConfig<D>(data: D, config?: AxiosRequestConfig<D>): { config: AxiosRequestConfig<D>; metadata: ApiRequestMetadata[] }
  • transform<M, T>(metadata: M[], response: T): T