openapi-client-axios icon indicating copy to clipboard operation
openapi-client-axios copied to clipboard

Add constructor option to allow reusing an axios instance

Open mikebolt opened this issue 1 year ago • 1 comments

This is for issue #77

This adds the axiosInstance property to the constructor options. This PR also includes some refactoring and new tests.

I added this because some users want the option to reuse another axios instance. The change will make this library compatible with more libraries.

I added tests to ensure that none of the properties of the default request config are changed. This partially addresses npdev453's 2nd point in the issue thread. The baseUrl property is the only one that might be modified, but only when it's undefined.

The documentation needs to be updated to inform the user about potential problems with using the axiosInstance property. It looks like the documentation is separate from this repo, so I can't edit it, but I added the new property to the function documentation.

mikebolt avatar Oct 16 '24 23:10 mikebolt