diff --git a/lib/opencnam.js b/lib/opencnam.js index 3dfe9d0..7448214 100644 --- a/lib/opencnam.js +++ b/lib/opencnam.js @@ -36,7 +36,13 @@ exports.lookup = function(phone_number, options, callback) { return callback(new Error('phone_number must be 10 digits.')); } - var uri = OPENCNAM_API_URI + phone_number + '?format=text'; + var format = 'format=text'; + + if (options.format) { + format = 'format=' + options.format; + } + + var uri = OPENCNAM_API_URI + phone_number + '?' + format; if (options.account_sid) { uri += '&account_sid=' + encodeURIComponent(options.account_sid);