Merge pull request #274 from CartoDB/url_rewrite

allow urls like /u/:user/
This commit is contained in:
Raul Ochoa 2015-03-20 12:21:41 +01:00
commit 63ba75f703
6 changed files with 52 additions and 45 deletions

View File

@ -14,11 +14,11 @@ var config = {
// Base url for the Templated Maps API // Base url for the Templated Maps API
// "/api/v1/map/named" is the new API, // "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x // "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/tiles/template)' ,base_url_templated: '(?:/api/v1/map/named|/tiles/template|/u/:user/api/v1/map/named|/u/:user/tiles/template)'
// Base url for the Detached Maps API // Base url for the Detached Maps API
// "maps" is the the new API, // "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x // "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/tiles/layergroup)' ,base_url_detached: '(?:/api/v1/map|/tiles/layergroup|/u/:user/api/v1/map|/u/:user/tiles/layergroup)'
// Base url for the Inline Maps and Table Maps API // Base url for the Inline Maps and Table Maps API
,base_url_legacy: '/tiles/:table' ,base_url_legacy: '/tiles/:table'

View File

@ -14,11 +14,11 @@ var config = {
// Base url for the Templated Maps API // Base url for the Templated Maps API
// "/api/v1/map/named" is the new API, // "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x // "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/tiles/template)' ,base_url_templated: '(?:/api/v1/map/named|/tiles/template|/u/:user/api/v1/map/named|/u/:user/tiles/template)'
// Base url for the Detached Maps API // Base url for the Detached Maps API
// "maps" is the the new API, // "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x // "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/tiles/layergroup)' ,base_url_detached: '(?:/api/v1/map|/tiles/layergroup|/u/:user/api/v1/map|/u/:user/tiles/layergroup)'
// Base url for the Inline Maps and Table Maps API // Base url for the Inline Maps and Table Maps API
,base_url_legacy: '/tiles/:table' ,base_url_legacy: '/tiles/:table'

View File

@ -14,11 +14,11 @@ var config = {
// Base url for the Templated Maps API // Base url for the Templated Maps API
// "/api/v1/maps/named" is the new API, // "/api/v1/maps/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x // "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/maps/named|/tiles/template)' ,base_url_templated: '(?:/api/v1/map/named|/tiles/template|/u/:user/api/v1/map/named|/u/:user/tiles/template)'
// Base url for the Detached Maps API // Base url for the Detached Maps API
// "/api/v1/maps" is the the new API, // "/api/v1/maps" is the the new API,
// "/tiles/layergroup" is for compatibility with versions up to 1.6.x // "/tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/maps|/tiles/layergroup)' ,base_url_detached: '(?:/api/v1/map|/tiles/layergroup|/u/:user/api/v1/map|/u/:user/tiles/layergroup)'
// Base url for the Inline Maps and Table Maps API // Base url for the Inline Maps and Table Maps API
,base_url_legacy: '/tiles/:table' ,base_url_legacy: '/tiles/:table'

View File

@ -14,11 +14,11 @@ var config = {
// Base url for the Templated Maps API // Base url for the Templated Maps API
// "/api/v1/map/named" is the new API, // "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x // "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/tiles/template)' ,base_url_templated: '(?:/api/v1/map/named|/tiles/template|/u/:user/api/v1/map/named|/u/:user/tiles/template)'
// Base url for the Detached Maps API // Base url for the Detached Maps API
// "maps" is the the new API, // "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x // "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/tiles/layergroup)' ,base_url_detached: '(?:/api/v1/map|/tiles/layergroup|/u/:user/api/v1/map|/u/:user/tiles/layergroup)'
// Base url for the Inline Maps and Table Maps API // Base url for the Inline Maps and Table Maps API
,base_url_legacy: '/tiles/:table' ,base_url_legacy: '/tiles/:table'

View File

@ -18,6 +18,7 @@ if ( _.isUndefined(global.environment.sqlapi.domain) ) {
// Whitelist query parameters and attach format // Whitelist query parameters and attach format
var REQUEST_QUERY_PARAMS_WHITELIST = [ var REQUEST_QUERY_PARAMS_WHITELIST = [
'user',
'sql', 'sql',
'geom_type', 'geom_type',
'cache_buster', 'cache_buster',
@ -377,6 +378,9 @@ module.exports = function(redisPool) {
me.userByReq = function(req) { me.userByReq = function(req) {
var host = req.headers.host; var host = req.headers.host;
if (req.params.user) {
return req.params.user;
}
var mat = host.match(this.re_userFromHost); var mat = host.match(this.re_userFromHost);
if ( ! mat ) { if ( ! mat ) {
console.error("ERROR: user pattern '" + this.re_userFromHost + "' does not match hostname '" + host + "'"); console.error("ERROR: user pattern '" + this.re_userFromHost + "' does not match hostname '" + host + "'");

View File

@ -22,9 +22,11 @@ serverOptions = ServerOptions();
var server = new CartodbWindshaft(serverOptions); var server = new CartodbWindshaft(serverOptions);
server.setMaxListeners(0); server.setMaxListeners(0);
['/tiles/layergroup', '/u/localhost/tiles/layergroup'].forEach(function(layergroup_url) {
[true, false].forEach(function(cdbQueryTablesFromPostgresEnabledValue) { [true, false].forEach(function(cdbQueryTablesFromPostgresEnabledValue) {
suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function() { var suiteName = 'multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue + ";layergroup_url=" + layergroup_url;
suite(suiteName, function() {
var redis_client = redis.createClient(global.environment.redis.port); var redis_client = redis.createClient(global.environment.redis.port);
var sqlapi_server; var sqlapi_server;
@ -66,7 +68,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -94,7 +96,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png', url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -135,7 +137,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/localhost@' + expected_token + ':cb0/0/0/0.png', url: layergroup_url + '/localhost@' + expected_token + ':cb0/0/0/0.png',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -152,7 +154,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token url: layergroup_url + "/" + expected_token
+ '/0/0/0/0.grid.json', + '/0/0/0/0.grid.json',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
method: 'GET' method: 'GET'
@ -170,7 +172,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token url: layergroup_url + "/" + expected_token
+ '/1/0/0/0.grid.json', + '/1/0/0/0.grid.json',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
method: 'GET' method: 'GET'
@ -222,7 +224,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify(layergroup)), url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)),
method: 'GET', method: 'GET',
headers: {host: 'localhost'} headers: {host: 'localhost'}
}, {}, function(res, err) { next(err, res); }); }, {}, function(res, err) { next(err, res); });
@ -255,7 +257,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify(layergroup)), url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)),
method: 'GET', method: 'GET',
headers: {host: 'localhost'} headers: {host: 'localhost'}
}, {}, function(res, err) { next(err, res); }); }, {}, function(res, err) { next(err, res); });
@ -299,7 +301,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
] ]
}; };
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify(layergroup)), url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)),
method: 'GET', method: 'GET',
headers: {host: 'localhost'} headers: {host: 'localhost'}
}, {}, function(res) { }, {}, function(res) {
@ -321,7 +323,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
] ]
}; };
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify(layergroup)), url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)),
method: 'GET', method: 'GET',
headers: {host: 'localhost'} headers: {host: 'localhost'}
}, {}, function(res) { }, {}, function(res) {
@ -352,7 +354,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -379,7 +381,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb10/1/0/0.png', url: layergroup_url + "/" + expected_token + ':cb10/1/0/0.png',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -418,7 +420,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb11/4/0/0.png', url: layergroup_url + "/" + expected_token + ':cb11/4/0/0.png',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -457,7 +459,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token url: layergroup_url + "/" + expected_token
+ '/0/1/0/0.grid.json', + '/0/1/0/0.grid.json',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
method: 'GET' method: 'GET'
@ -475,7 +477,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token url: layergroup_url + "/" + expected_token
+ '/0/4/0/0.grid.json', + '/0/4/0/0.grid.json',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
method: 'GET' method: 'GET'
@ -539,7 +541,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -561,7 +563,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
+ statskey + ":stat_tag:" + layergroup.stat_tag + " to be 1, got " + val); + statskey + ":stat_tag:" + layergroup.stat_tag + " to be 1, got " + val);
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -620,7 +622,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
] ]
}; };
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -648,7 +650,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
] ]
}; };
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -688,7 +690,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup?map_key=1234', url: layergroup_url + '?map_key=1234',
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -716,7 +718,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png?map_key=1234', url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png?map_key=1234',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -737,7 +739,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token url: layergroup_url + "/" + expected_token
+ '/0/0/0/0.grid.json?map_key=1234', + '/0/0/0/0.grid.json?map_key=1234',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
method: 'GET' method: 'GET'
@ -751,7 +753,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token url: layergroup_url + "/" + expected_token
+ '/1/0/0/0.grid.json?map_key=1234', + '/1/0/0/0.grid.json?map_key=1234',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
method: 'GET' method: 'GET'
@ -766,7 +768,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png', url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -782,7 +784,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token url: layergroup_url + "/" + expected_token
+ '/0/0/0/0.grid.json', + '/0/0/0/0.grid.json',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
method: 'GET' method: 'GET'
@ -798,7 +800,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token url: layergroup_url + "/" + expected_token
+ '/1/0/0/0.grid.json', + '/1/0/0/0.grid.json',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
method: 'GET' method: 'GET'
@ -849,7 +851,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup?map_key=1234', url: layergroup_url + '?map_key=1234',
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -878,7 +880,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png?map_key=1234', url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png?map_key=1234',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -908,7 +910,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png?map_key=1234', url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png?map_key=1234',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -1044,7 +1046,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -1068,7 +1070,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png', url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -1120,7 +1122,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup?api_key=1234', url: layergroup_url + '?api_key=1234',
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -1146,7 +1148,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
if ( err ) throw err; if ( err ) throw err;
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png?api_key=1234', url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png?api_key=1234',
method: 'GET', method: 'GET',
headers: {host: 'localhost' }, headers: {host: 'localhost' },
encoding: 'binary' encoding: 'binary'
@ -1211,7 +1213,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
assert.ok(data.length > 1024*64); assert.ok(data.length > 1024*64);
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup?api_key=1234', url: layergroup_url + '?api_key=1234',
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: data data: data
@ -1268,7 +1270,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -1310,7 +1312,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
{ {
var next = this; var next = this;
assert.response(server, { assert.response(server, {
url: '/tiles/layergroup', url: layergroup_url,
method: 'POST', method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' }, headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup) data: JSON.stringify(layergroup)
@ -1334,7 +1336,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
} }
var layergroupTtlRequest = { var layergroupTtlRequest = {
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify({ url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify({
version: '1.0.0', version: '1.0.0',
layers: [ layers: [
{ options: { { options: {
@ -1442,3 +1444,4 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
}); });
}); });
});