diff --git a/CHANGELOG.md b/CHANGELOG.md index 81bb8c3..2bf1712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index e577c76..5cb98de 100644 --- a/README.md +++ b/README.md @@ -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); }); diff --git a/lib/api.js b/lib/api.js index 5cf363a..90e0b58 100644 --- a/lib/api.js +++ b/lib/api.js @@ -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; diff --git a/test/mailhops.js b/test/mailhops.js index 4fe8ba8..70a909e 100644 --- a/test/mailhops.js +++ b/test/mailhops.js @@ -15,7 +15,7 @@ describe("mailhops", function(){ var required_keys = [ "configure", "lookup", - "mapUrl", + "mapUrl" ] assert.deepEqual(_.keys(mailhops.__proto__), required_keys); diff --git a/test/main.js b/test/main.js index bbb8f72..c9fab96 100644 --- a/test/main.js +++ b/test/main.js @@ -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(); + }); + }); }); });