This repository was archived by the owner on Feb 13, 2024. It is now read-only.
Feature: Allow passing axios instance or config in options. #240
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background:
I have an Electron app using axios for HTTP where I am using a custom adapter to get around proxy issues by using Electron's
net
module.My workaround:
The current version of
analytics-node
doesn't expose any configuration foraxios
, so I added the followingoptions
properties:axiosConfig
: configuration options for creating an axios instance if you don't have axios as a dependencyaxiosInstance
: instance of axios if you already have axios as a dependency, maybe with a different versionIt's not ideal from a library-coupling perspective, but I didn't see an easy way to avoid that without
defining some library-agnostic interface for the HTTP adapter which would still support retries, which seems overkill.
I just thought I would post this PR in case it was a useful enhancement.
Alternative considered:
One option
axios
with either a config object or a function returning an axios instance.