HttpService

  
class HttpService {
  constructor(instance: AxiosInstance = Axios)
  protected instance: AxiosInstance
  axiosRef: AxiosInstance
  request<T = any>(config: AxiosRequestConfig): Observable<AxiosResponse<T>>
  get<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>
  delete<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>
  head<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>
  post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>
  put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>
  patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>
  protected makeObservable<T>(axios: (...args: any[]) => AxiosPromise<T>, ...args: any[])
}

Constructor


constructor(instance: AxiosInstance = Axios)

Parameters

Option Type Description
instance AxiosInstance

Optional. Default is Axios.

Properties

Property Description
protected instance: AxiosInstance Read-only. Declared in constructor.
axiosRef: AxiosInstance Read-only.

Methods

request()


request<T = any>(config: AxiosRequestConfig): Observable<AxiosResponse<T>>

Parameters

Option Type Description
config AxiosRequestConfig

Returns

Observable<AxiosResponse<T>>

get()


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

Parameters

Option Type Description
url string
config AxiosRequestConfig

Optional. Default is undefined.

Returns

Observable<AxiosResponse<T>>

delete()


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

Parameters

Option Type Description
url string
config AxiosRequestConfig

Optional. Default is undefined.

Returns

Observable<AxiosResponse<T>>

head()


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

Parameters

Option Type Description
url string
config AxiosRequestConfig

Optional. Default is undefined.

Returns

Observable<AxiosResponse<T>>

post()


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

Parameters

Option Type Description
url string
data any

Optional. Default is undefined.

config AxiosRequestConfig

Optional. Default is undefined.

Returns

Observable<AxiosResponse<T>>

put()


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

Parameters

Option Type Description
url string
data any

Optional. Default is undefined.

config AxiosRequestConfig

Optional. Default is undefined.

Returns

Observable<AxiosResponse<T>>

patch()


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

Parameters

Option Type Description
url string
data any

Optional. Default is undefined.

config AxiosRequestConfig

Optional. Default is undefined.

Returns

Observable<AxiosResponse<T>>

makeObservable()


protected makeObservable<T>(axios: (...args: any[]) => AxiosPromise<T>, ...args: any[])

Parameters

Option Type Description
axios (...args: any[]) => AxiosPromise
args any[]