CallAnApi
Hierarchy
- Ability
- CallAnApi
Index
Methods
Constructors
Methods
staticat
staticusing
Produces an ability to call a REST API using a given axios instance.
Useful when you need to customise Axios to make it aware of proxies, for example.
Learn more
Parameters
axiosInstance: AxiosInstance
Returns CallAnApi
modifyConfig
request
Sends an HTTP request to a specified url. Response will be cached and available via mapLastResponse
Learn more
Parameters
config: AxiosRequestConfig<any>
Returns Promise<AxiosResponse<any, any>>
resolveUrl
Resolves the final URL, based on the AxiosRequestConfig provided and any defaults that the AxiosInstance has been configured with.
Learn more
Parameters
config: AxiosRequestConfig<any>
Returns string
mapLastResponse
Maps the last cached response to another type. Useful when you need to extract a portion of the AxiosResponse object.
Learn more
Type parameters
- T
Parameters
mappingFunction: (response: AxiosResponse<any, any>) => T
Returns T
Constructors
constructor
Learn more
Parameters
axiosInstance: AxiosInstance
A pre-configured instance of the Axios HTTP client
Returns CallAnApi
An Ability that enables the Actor to call an HTTP API.
If you need to connect via a proxy, check out “Using Axios behind corporate proxies”.
Using the default Axios HTTP client
Using Axios client with custom configuration
Learn more