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

add lookup param for request #357

Closed
wants to merge 1 commit into from
Closed

add lookup param for request #357

wants to merge 1 commit into from

Conversation

machao
Copy link
Contributor

@machao machao commented Jun 15, 2021

http://nodejs.cn/api/http.html#http_http_request_url_options_callback

usage:

needle({
  url,
  lookup: (hostname, options, callback) => {
     if(hostname.endsWith('.localhost')) {
        setImmediate(() => {
           callback(null, '127.0.0.1', 4);
        });
        return
     }
     dns.lookup(hostname, options, callback);
  }
})

@@ -16,7 +16,8 @@ var fs = require('fs'),
auth = require('./auth'),
cookies = require('./cookies'),
parsers = require('./parsers'),
decoder = require('./decoder');
decoder = require('./decoder'),
dns = require('dns');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to be necessary

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@machao could you update the PR?

@lyswhut
Copy link

lyswhut commented Jun 17, 2021

I need this option and hope to merge soon

@machao machao closed this Jun 27, 2021
@lyswhut
Copy link

lyswhut commented Jun 27, 2021

@machao Don't close it directly, please update this PR to merge it?
Thank

@machao
Copy link
Contributor Author

machao commented Jun 27, 2021

i'm sorry about useless code in this pr, and i open new one. #360

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 this pull request may close these issues.

3 participants