1
0
mirror of https://github.com/MailHops/mailhops-node.git synced 2025-05-15 19:30:13 -07:00

Added option to pass route as an array

This commit is contained in:
Andrew Van Tassel 2015-06-14 12:32:45 -06:00
parent 09c02e0385
commit f81254af73
5 changed files with 13 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# Change Log
All notable changes to this project will be documented in this file.
## [0.0.2] - 2015-06-15
## [Unreleased][unreleased]
### Added
- Header parsing

View File

@ -44,7 +44,7 @@ var options = {
mailhops.configure(options);
mailhops.lookup('216.58.217.46,98.138.253.109',function(err,response){
mailhops.lookup(['216.58.217.46','98.138.253.109'],function(err,response){
console.log(response);
});

View File

@ -14,7 +14,7 @@ module.exports = {
var qs = options;
qs.api_key = this.api_key || '';
qs.c = this.show_client;
qs.r = route.replace(" ", "+");
qs.r = Array.isArray(route) ? route.join(',').replace(" ", "") : route.replace(" ", "");
if(this.forecastio_api_key)
qs.fkey = this.forecastio_api_key;
@ -33,7 +33,7 @@ module.exports = {
var qs = options || {};
qs.api_key = this.api_key || '';
qs.c = this.show_client;
qs.r = route.replace(" ", "+");
qs.r = Array.isArray(route) ? route.join(',').replace(" ", "") : route.replace(" ", "");
if(this.forecastio_api_key)
qs.fkey = this.forecastio_api_key;

View File

@ -15,7 +15,7 @@ describe("mailhops", function(){
var required_keys = [
"configure",
"lookup",
"mapUrl",
"mapUrl"
]
assert.deepEqual(_.keys(mailhops.__proto__), required_keys);

View File

@ -39,6 +39,14 @@ describe("main", function(){
done();
});
});
it('array lookup test should return a 200 response with private ip', function(done){
mailhops.lookup(['127.0.0.1','216.58.217.46','98.138.253.109'], function(err, response){
assert.equal(response.meta['code'],200);
assert.equal(response.response.route[0]['private'],true);
done();
});
});
});
});