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

[Question] How to install globally properly #44

Closed
Kikobeats opened this issue Sep 19, 2021 · 2 comments · Fixed by #45
Closed

[Question] How to install globally properly #44

Kikobeats opened this issue Sep 19, 2021 · 2 comments · Fixed by #45

Comments

@Kikobeats
Copy link
Contributor

Hello,

I was wondering if global installation needs to wrap just HTTP agent or also HTTPS as well?

const http = require('http');
const CacheableLookup = require('cacheable-lookup');
const cacheable = new CacheableLookup({
    // Set any custom options here
});
cacheable.servers = [
    // Put your DNS servers of choice here
];

// Configure this to be used by a single request:
http.get("http://example.com", {
    lookup: cacheable.lookup
});

Essentially, I should do this:

cacheable.install(http.globalAgent);

or also this?

cacheable.install(http.globalAgent);
cacheable.install(https.globalAgent);
@szmarczak
Copy link
Owner

Both, as http != https

@Kikobeats
Copy link
Contributor Author

Thanks for clarifying; I created a PR just to help to clarify other people

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

Successfully merging a pull request may close this issue.

2 participants