Commit 2fc62cba authored by Matthew Taylor's avatar Matthew Taylor Committed by GitHub

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

[Develop] Fix GH-828: check street number range for address
parents 47d0cca8 4d9fe86f
var defaults = require('lodash.defaults');
var defaultsDeep = require('lodash.defaultsdeep');
var xhr = require('xhr');
var jar = require('./jar');
......@@ -15,17 +16,15 @@ var urlParams = require('./url-params');
*/
module.exports = function (opts, callback) {
defaults(opts, {
defaultsDeep(opts, {
host: process.env.API_HOST,
headers: {},
headers: {
'X-Requested-With': 'XMLHttpRequest'
},
responseType: 'json',
useCsrf: false
});
defaults(opts.headers, {
'X-Requested-With': 'XMLHttpRequest'
});
opts.uri = opts.host + opts.uri;
if (opts.params) {
......@@ -43,7 +42,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});
if (opts.useXDR) {
delete opts.headers;
}
if (opts.authentication) {
var authenticationParams = ['x-token=' + opts.authentication];
var parts = opts.uri.split('?');
......
......@@ -8,7 +8,11 @@ module.exports = function smartyStreetApi (params, callback) {
api({
host: 'https://api.smartystreets.com',
uri: '/street-address',
params: params
headers: {
'X-Standardize-Only': true
},
params: params,
useXDR: false
}, function (err, body, res) {
if (err) return callback(err);
if (res.statusCode !== 200) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment