Add data_version field to responses of all plugins. (#5387)
This commit is contained in:
@@ -117,6 +117,10 @@ module.exports = function () {
|
||||
got.duration = duration.toString();
|
||||
}
|
||||
|
||||
if (headers.has('data_version')) {
|
||||
got.data_version = json.data_version || '';
|
||||
}
|
||||
|
||||
// if header matches 'a:*', parse out the values for *
|
||||
// and return in that header
|
||||
headers.forEach((k) => {
|
||||
|
||||
@@ -8,6 +8,7 @@ module.exports = function () {
|
||||
this.reprocessAndLoadData((e) => {
|
||||
if (e) return callback(e);
|
||||
var testRow = (row, ri, cb) => {
|
||||
|
||||
var inNode = this.findNodeByName(row.in);
|
||||
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in));
|
||||
|
||||
@@ -17,6 +18,7 @@ module.exports = function () {
|
||||
this.requestNearest(inNode, this.queryParams, (err, response) => {
|
||||
if (err) return cb(err);
|
||||
var coord;
|
||||
var headers = new Set(table.raw()[0]);
|
||||
|
||||
if (response.statusCode === 200 && response.body.length) {
|
||||
var json = JSON.parse(response.body);
|
||||
@@ -25,6 +27,10 @@ module.exports = function () {
|
||||
|
||||
var got = { in: row.in, out: row.out };
|
||||
|
||||
if (headers.has('data_version')) {
|
||||
got.data_version = json.data_version || '';
|
||||
}
|
||||
|
||||
Object.keys(row).forEach((key) => {
|
||||
if (key === 'out') {
|
||||
if (this.FuzzyMatch.matchLocation(coord, outNode)) {
|
||||
|
||||
@@ -43,6 +43,10 @@ module.exports = function () {
|
||||
got.message = json.message;
|
||||
}
|
||||
|
||||
if (headers.has('data_version')) {
|
||||
got.data_version = json.data_version || '';
|
||||
}
|
||||
|
||||
if (headers.has('geometry')) {
|
||||
if (this.queryParams['geometries'] === 'polyline') {
|
||||
got.geometry = polyline.decode(json.trips[0].geometry).toString();
|
||||
|
||||
Reference in New Issue
Block a user