diff --git a/index.js b/index.js index a304e0f..29d8a7e 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,7 @@ function Screenshot(url, opts) { this.format('png'); Object.keys(opts || {}).forEach(function (key) { - this[key](opts[key]); + if (typeof this[key] == 'function') this[key](opts[key]); }.bind(this)); } diff --git a/test.js b/test.js index fd8a830..78596dc 100644 --- a/test.js +++ b/test.js @@ -35,12 +35,14 @@ var server = http.createServer(function(req, res) { width: 1024, height: 768, timeout: 100, - format: 'jpeg' + format: 'jpeg', + url: 'trololo' }); t.equal(s._width, 1024); t.equal(s._height, 768); t.equal(s._timeout, 100); t.equal(s._format, 'JPG'); + t.equal(s.url, url); t.end(); });