Customize axios requests at the instance or request level
masterThe library allows you to pass axios configuration at two levels:
- Global Level: Pass an
axiosobject duringnew B2({...})instantiation to set default configurations for all requests. - Request Level: Pass
axiosoraxiosOverridearguments to specific method calls.
Behavioral difference:
axios: Properties are added to the request object only if they do not conflict with existing properties. It performs a recursive merge.axiosOverride: Properties are added by overriding conflicting properties. Use this with caution.
Example of request-level configuration:
const common_args = {
axios: {
timeout: 30000
}
};
b2.getBucket({ bucketName: 'my-bucket' }, common_args);