Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this with axios? #70

Open
ashokkumar88 opened this issue Jan 23, 2021 · 2 comments
Open

How to use this with axios? #70

ashokkumar88 opened this issue Jan 23, 2021 · 2 comments

Comments

@ashokkumar88
Copy link

How to use dns-lookup-cache with axios?

@curlyblueeagle
Copy link

Same question. Axios uses http module not request or direct dns lookup so not sure if this library will help?

@przemek-oc
Copy link

przemek-oc commented Jan 27, 2022

Hello,
I'm wrapping axios into my own HTTPClient wrapper, but I guess you can already tell by code how to adapt it to your case:

`

const { lookup } = require("dns-lookup-cache");
let httpsAgent = new https.Agent({
keepAlive: true,
lookup: lookup
});

    this.instance = axios.create({
        baseURL,
        httpsAgent: httpsAgent,
    }); 

`

Edit: I can't use code snippet here lol :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants