|
|
|
@ -7,19 +7,19 @@ const logger = require('pelias-logger').get('api');
|
|
|
|
|
const logging = require( '../helper/logging' ); |
|
|
|
|
const retry = require('retry'); |
|
|
|
|
|
|
|
|
|
function setup( apiConfig, esclient, query ){ |
|
|
|
|
function requestHasErrors(request) { |
|
|
|
|
return _.get(request, 'errors', []).length > 0; |
|
|
|
|
} |
|
|
|
|
function requestHasErrors(request) { |
|
|
|
|
return _.get(request, 'errors', []).length > 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function responseHasData(response) { |
|
|
|
|
return _.get(response, 'data', []).length > 0; |
|
|
|
|
} |
|
|
|
|
function responseHasData(response) { |
|
|
|
|
return _.get(response, 'data', []).length > 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function isRequestTimeout(err) { |
|
|
|
|
return _.get(err, 'status') === 408; |
|
|
|
|
} |
|
|
|
|
function isRequestTimeout(err) { |
|
|
|
|
return _.get(err, 'status') === 408; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function setup( apiConfig, esclient, query ){ |
|
|
|
|
function controller( req, res, next ){ |
|
|
|
|
// do not run controller when a request
|
|
|
|
|
// validation error has occurred.
|
|
|
|
|