mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Check for callback argument in DNS functions
This commit is contained in:
1 parent
3c97a4391a
commit
217e4b40d4
2 files changed
+13
No files matched your search
@@ -332,6 +332,11 @@ static Handle<Value> ResolveA(int type, const Arguments& args) {
|
||||
String::New("Argument must be a string.")));
|
||||
}
|
||||
|
||||
if (!args[1]->IsFunction()) {
|
||||
return ThrowException(Exception::Error(
|
||||
String::New("Missing callback argument")));
|
||||
}
|
||||
|
||||
String::Utf8Value name(args[0]->ToString());
|
||||
|
||||
struct dns_query *query;
|
||||
|
||||
@@ -3,6 +3,14 @@ require("../common");
|
||||
var dns = require("dns"),
|
||||
sys = require("sys");
|
||||
|
||||
|
||||
// Try resolution without callback
|
||||
|
||||
assert.throws(function () {
|
||||
dns.resolve('google.com', 'A');
|
||||
})
|
||||
|
||||
|
||||
var hosts = ['example.com', 'example.org',
|
||||
'ietf.org', // AAAA
|
||||
'google.com', // MX, multiple A records
|
||||
|
||||
Reference in new issue
Block a user