question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for using custom instance of axios

See original GitHub issue

When using the httpClient: 'axios' option, I would like to be able to also use a custom axios instance for making the requests.

The reason for that is that I would like to use an Axios instance configured to my liking (custom interceptors, different timeout value, etc…).

Looking at the code it seems that it would be pretty easy to support that and I could contribute if the feature request is accepted.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:18
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
AllanPinheiroDeLimacommented, May 30, 2022

Having an option to use custom instances would be great. I actually have a problem where a can’t use interceptors nor set language headers in a nuxt app because the framework encapsulates the options from the composables.

Unless I’m doing something very wrong, I can’t have multiple configs working for all parts of my app without dropping this lib entirely

0reactions
sam-mfbcommented, Aug 12, 2022

Makes sense to me as well. I think you also want the generated code to export the created axios instance so that your consumer code could set the default config for the instance via myAxiosInstance.default without messing with the generated code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Axios Instance | Axios Docs
The Axios Instance. Creating an instance. You can create a new instance of axios with a custom config. axios.create([config]).
Read more >
How to Create a Custom Axios Instance? - RapidAPI
Axios allows us to create new instances with custom configuration. This guide will demonstrate how to create a custom instance with Axios.
Read more >
Understanding Axios.create - LogRocket Blog
Axios.create is a handy feature within Axios used to create a new instance with a custom configuration. With Axios.create, we can generate a ......
Read more >
Custom Axios Instance - use-axios-client
You can define a custom axios instance to be used for a request. This is useful if your app needs to interact with...
Read more >
Complete Guide to Axios HTTP Client - Reflectoring
An Axios instance created with Axios.create() with a custom config helps us to reuse the provided configuration for all the API invocations made ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found