Merge pull request #829 from mewtaylor/hotfix/gh-828

[Master] Fix GH-828: check street number range for address
This commit is contained in:
Matthew Taylor 2016-08-12 17:13:41 -04:00 committed by GitHub
commit 9afb4b6563
2 changed files with 10 additions and 5 deletions

View file

@ -22,9 +22,11 @@ module.exports = function (opts, callback) {
useCsrf: false
});
defaults(opts.headers, {
'X-Requested-With': 'XMLHttpRequest'
});
if (opts.host === '') {
defaults(opts.headers, {
'X-Requested-With': 'XMLHttpRequest'
});
}
opts.uri = opts.host + opts.uri;
@ -43,7 +45,9 @@ module.exports = function (opts, callback) {
// For IE < 10, we must use XDR for cross-domain requests. XDR does not support
// custom headers.
defaults(opts, {useXDR: true});
delete opts.headers;
if (opts.useXDR) {
delete opts.headers;
}
if (opts.authentication) {
var authenticationParams = ['x-token=' + opts.authentication];
var parts = opts.uri.split('?');

View file

@ -3,7 +3,8 @@ var api = require('./api');
module.exports = function smartyStreetApi (params, callback) {
defaults(params, {
'auth-id': process.env.SMARTY_STREETS_API_KEY
'auth-id': process.env.SMARTY_STREETS_API_KEY,
'match': 'range'
});
api({
host: 'https://api.smartystreets.com',