2018-10-24 21:42:33 +08:00
|
|
|
'use strict';
|
|
|
|
|
2018-05-04 16:50:14 +08:00
|
|
|
require('../helper');
|
|
|
|
|
2019-10-04 00:24:39 +08:00
|
|
|
const server = require('../../lib/server')();
|
2018-05-04 21:27:56 +08:00
|
|
|
const assert = require('../support/assert');
|
2018-05-04 16:50:14 +08:00
|
|
|
|
|
|
|
describe('query-multipart', function() {
|
2018-05-09 00:38:57 +08:00
|
|
|
it('make query from a multipart form', function(done){
|
2018-05-04 16:50:14 +08:00
|
|
|
assert.response(server, {
|
|
|
|
url: '/api/v1/sql',
|
|
|
|
formData: {
|
|
|
|
q: 'SELECT 2 as n'
|
|
|
|
},
|
|
|
|
headers: {host: 'vizzuality.cartodb.com'},
|
|
|
|
method: 'POST'
|
|
|
|
},{}, function(err, res) {
|
|
|
|
assert.ifError(err);
|
|
|
|
const response = JSON.parse(res.body);
|
2018-05-23 03:24:19 +08:00
|
|
|
assert.equal(typeof(response.time) !== 'undefined', true);
|
2018-05-04 16:50:14 +08:00
|
|
|
assert.strictEqual(response.total_rows, 1);
|
|
|
|
assert.deepStrictEqual(response.rows, [{n:2}]);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|