Skip to content

Response object

Axios cache interceptor returns a slightly changed than the original axios response. Containing information about the cache and other needed properties.

id

  • Type: string

The Request ID used in this request.

It may have been generated by the Key Generator or a custom one provided by config.id

ts
const response = await axios.get('url', { id: 'my-overridden-id' });

// This request used 'my-overridden-id' and
// not the one generated by the key generator
response.id === 'my-overridden-id';

cached

  • Type: boolean

A simple boolean indicating if the request returned data from the cache or from the network call.

TIP

This does not indicated if the request was capable of being cached or not, as options like cache.override may have been enabled.

Made with ❤️