mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
Merge pull request #829 from mewtaylor/hotfix/gh-828
[Master] Fix GH-828: check street number range for address
This commit is contained in:
commit
9afb4b6563
2 changed files with 10 additions and 5 deletions
|
@ -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('?');
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue