Question: Is there any reason why global axios defaults shouldn't be used in api-client.ts?

Author: cmacdonnachaCreated May 21, 2025Updated May 21, 2025

As per title, I was curious if there's any reason why global axios defaults shouldn't be used in api-client.ts?

So instead of:

typescript
  if (config.headers) {
    config.headers.Accept = 'application/json';
  }

you'd have:

axios.defaults.headers.common.Accept = 'application/json';

Source: alan2207/bulletproof-react