fixed provider url generation
This commit is contained in:
parent
fd03f92b83
commit
d0ab61ef6d
@ -127,7 +127,11 @@
|
||||
},
|
||||
|
||||
url: function() {
|
||||
return this.options.url || 'http://' + this.options.user + '.cartodb.com/api/v2/sql';
|
||||
var opts = this.options;
|
||||
var port = opts.sql_api_port;
|
||||
var domain = (opts.sql_api_domain || (this.options.user + '.cartodb.com')) + (port ? ':' + port: '');
|
||||
var protocol = opts.sql_api_protocol || 'http';
|
||||
return this.options.url || protocol + '://' + domain + '/api/v2/sql';
|
||||
},
|
||||
|
||||
// execute actual query
|
||||
|
14
test/provider.json.js
Normal file
14
test/provider.json.js
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
module('provider.json');
|
||||
|
||||
test("url", function() {
|
||||
var json = new torque.providers.json({
|
||||
user: "rambo",
|
||||
resolution: 1,
|
||||
steps: 10
|
||||
});
|
||||
equal("http://rambo.cartodb.com/api/v2/sql", json.url());
|
||||
});
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
module('provider.jsonarray');
|
||||
|
||||
test("processTile", function() {
|
||||
var json = new torque.providers.JsonArray({
|
||||
url: "http://test.com/{z}/{x}/{y}.json"
|
||||
|
@ -10,9 +10,13 @@
|
||||
<div id="qunit-fixture"></div>
|
||||
<script src="vendor/qunit.js"></script>
|
||||
|
||||
<script src="../lib/torque/core.js"></script>
|
||||
<script src="../lib/torque/request.js"></script>
|
||||
<script src="../lib/torque/provider.jsonarray.js"></script>
|
||||
<script src="../lib/torque/provider.json.js"></script>
|
||||
|
||||
<script src="data/torque.array.json"></script>
|
||||
<script src="provider.jsonarray.js"></script>
|
||||
<script src="provider.json.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user