From 7b57d22444fc4d75d1630bb8b66240c674186e50 Mon Sep 17 00:00:00 2001 From: Pablo Alonso Garcia Date: Mon, 26 Oct 2015 17:50:50 +0100 Subject: [PATCH] Added trailing slash to API endpoint in widget URLs --- lib/cartodb/controllers/map.js | 6 +++--- test/acceptance/lists.js | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/cartodb/controllers/map.js b/lib/cartodb/controllers/map.js index e514d8a9..117bb62d 100644 --- a/lib/cartodb/controllers/map.js +++ b/lib/cartodb/controllers/map.js @@ -349,13 +349,13 @@ function getUrls(username, resource) { var cdnUrl = global.environment.serverMetadata && global.environment.serverMetadata.cdn_url; if (cdnUrl) { return { - http: 'http://' + cdnUrl.http + '/' + username + '/api/v1/map' + resource, - https: 'https://' + cdnUrl.https + '/' + username + '/api/v1/map' + resource + http: 'http://' + cdnUrl.http + '/' + username + '/api/v1/map/' + resource, + https: 'https://' + cdnUrl.https + '/' + username + '/api/v1/map/' + resource }; } else { var port = global.environment.port; return { - http: 'http://' + username + '.' + 'localhost.lan:' + port + '/api/v1/map' + resource + http: 'http://' + username + '.' + 'localhost.lan:' + port + '/api/v1/map/' + resource }; } } diff --git a/test/acceptance/lists.js b/test/acceptance/lists.js index eb468105..ab94b79e 100644 --- a/test/acceptance/lists.js +++ b/test/acceptance/lists.js @@ -72,7 +72,12 @@ describe('lists', function() { return next(err); } var parsedBody = JSON.parse(res.body); + var expectedWidgetURLS = { + "http": "http://localhost.localhost.lan:8888" + + "/api/v1/map/adfb1f912ddb9a5af5e9ef0b2229ed3b:1234567890123/0/widget/names" + }; assert.ok(parsedBody.metadata.layers[0].widgets.names); + assert.equal(parsedBody.metadata.layers[0].widgets.names.url.http, expectedWidgetURLS.http); return next(null, parsedBody.layergroupid); } );