Fix parsing of numeric arrays. Closes #88.
Includes testcase, requires using a fork of node-postgresql.
This commit is contained in:
parent
133add8741
commit
5fa19a0515
1
NEWS.md
1
NEWS.md
@ -1,5 +1,6 @@
|
||||
1.3.7
|
||||
-----
|
||||
* Fix parsing of numeric arrays (#88)
|
||||
|
||||
1.3.6 (DD/MM/YY)
|
||||
-----
|
||||
|
5
npm-shrinkwrap.json
generated
5
npm-shrinkwrap.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cartodb_api",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.7",
|
||||
"dependencies": {
|
||||
"cluster2": {
|
||||
"version": "0.3.5-cdb02",
|
||||
@ -185,7 +185,8 @@
|
||||
}
|
||||
},
|
||||
"pg": {
|
||||
"version": "0.11.2",
|
||||
"version": "0.12.3-cdb1",
|
||||
"from": "git://github.com/CartoDB/node-postgres.git#cdb_production",
|
||||
"dependencies": {
|
||||
"generic-pool": {
|
||||
"version": "2.0.2"
|
||||
|
@ -13,7 +13,8 @@
|
||||
"express": "~2.5.11",
|
||||
"underscore" : "1.1.x",
|
||||
"underscore.string": "1.1.5",
|
||||
"pg": "~0.11.2",
|
||||
"pg": "git://github.com/CartoDB/node-postgres.git#cdb_production",
|
||||
"express": "~2.5.11",
|
||||
"generic-pool": "1.0.x",
|
||||
"redis": "0.7.1",
|
||||
"hiredis": "*",
|
||||
|
@ -669,6 +669,30 @@ test('GET decent error if SQL is broken', function(done){
|
||||
});
|
||||
});
|
||||
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/88
|
||||
test('numeric arrays are rendered as such', function(done){
|
||||
assert.response(app, {
|
||||
url: "/api/v1/sql?"
|
||||
+ querystring.stringify({q:
|
||||
"SELECT ARRAY[8.7,4.3]::numeric[] as x"
|
||||
}),
|
||||
headers: {host: 'vizzuality.localhost.lan:8080' },
|
||||
method: 'GET'
|
||||
},{}, function(res) {
|
||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||
var out = JSON.parse(res.body);
|
||||
assert.ok(out.hasOwnProperty('time'));
|
||||
assert.equal(out.total_rows, 1);
|
||||
assert.equal(out.rows.length, 1);
|
||||
assert.ok(out.rows[0].hasOwnProperty('x'));
|
||||
assert.equal(out.rows[0].x.length, 2);
|
||||
assert.equal(out.rows[0].x[0], '8.7');
|
||||
assert.equal(out.rows[0].x[1], '4.3');
|
||||
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:'); // keep forever
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
// GEOJSON tests
|
||||
|
||||
test('GET /api/v1/sql with SQL parameter and geojson format, ensuring content-disposition set to geojson', function(done){
|
||||
|
Loading…
Reference in New Issue
Block a user