undo style/format changes
This commit is contained in:
parent
1f03a6b181
commit
5abe25c316
@ -321,34 +321,19 @@ LayergroupController.prototype.finalizeGetTileOrGrid = function(err, req, res, t
|
|||||||
};
|
};
|
||||||
|
|
||||||
LayergroupController.prototype.bbox = function(req, res, next) {
|
LayergroupController.prototype.bbox = function(req, res, next) {
|
||||||
this.staticMap(
|
this.staticMap(req, res, +req.params.width, +req.params.height, {
|
||||||
req,
|
west: +req.params.west,
|
||||||
res,
|
north: +req.params.north,
|
||||||
+req.params.width,
|
east: +req.params.east,
|
||||||
+req.params.height,
|
south: +req.params.south
|
||||||
{
|
}, next);
|
||||||
west: +req.params.west,
|
|
||||||
north: +req.params.north,
|
|
||||||
east: +req.params.east,
|
|
||||||
south: +req.params.south
|
|
||||||
},
|
|
||||||
next
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LayergroupController.prototype.center = function(req, res, next) {
|
LayergroupController.prototype.center = function(req, res, next) {
|
||||||
this.staticMap(
|
this.staticMap(req, res, +req.params.width, +req.params.height, +req.params.z, {
|
||||||
req,
|
lng: +req.params.lng,
|
||||||
res,
|
lat: +req.params.lat
|
||||||
+req.params.width,
|
}, next);
|
||||||
+req.params.height,
|
|
||||||
+req.params.z,
|
|
||||||
{
|
|
||||||
lng: +req.params.lng,
|
|
||||||
lat: +req.params.lat
|
|
||||||
},
|
|
||||||
next
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LayergroupController.prototype.staticMap = function(req, res, width, height, zoom /* bounds */, center, next) {
|
LayergroupController.prototype.staticMap = function(req, res, width, height, zoom /* bounds */, center, next) {
|
||||||
|
@ -73,33 +73,33 @@ describe('prepare-context', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('cleans up request', function(done){
|
it('cleans up request', function(done){
|
||||||
var req = {headers: { host:'localhost' }, query: {dbuser:'hacker',dbname:'secret'}};
|
var req = {headers: { host:'localhost' }, query: {dbuser:'hacker',dbname:'secret'}};
|
||||||
var res = {};
|
var res = {};
|
||||||
|
|
||||||
cleanUpQueryParams(prepareRequest(req), prepareResponse(res), function(err) {
|
cleanUpQueryParams(prepareRequest(req), prepareResponse(res), function(err) {
|
||||||
if ( err ) { done(err); return; }
|
if ( err ) { done(err); return; }
|
||||||
assert.ok(_.isObject(req.query), 'request has query');
|
assert.ok(_.isObject(req.query), 'request has query');
|
||||||
assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query');
|
assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query');
|
||||||
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
||||||
assert.ok(!res.locals.hasOwnProperty('interactivity'), 'response locals do not have interactivity');
|
assert.ok(!res.locals.hasOwnProperty('interactivity'), 'response locals do not have interactivity');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets dbname from redis metadata', function(done){
|
it('sets dbname from redis metadata', function(done){
|
||||||
var req = {headers: { host:'localhost' }, query: {} };
|
var req = {headers: { host:'localhost' }, query: {} };
|
||||||
var res = {};
|
var res = {};
|
||||||
|
|
||||||
dbConnSetup(prepareRequest(req), prepareResponse(res), function(err) {
|
dbConnSetup(prepareRequest(req), prepareResponse(res), function(err) {
|
||||||
if ( err ) { done(err); return; }
|
if ( err ) { done(err); return; }
|
||||||
assert.ok(_.isObject(req.query), 'request has query');
|
assert.ok(_.isObject(req.query), 'request has query');
|
||||||
assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query');
|
assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query');
|
||||||
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
||||||
assert.ok(!res.locals.hasOwnProperty('interactivity'), 'response locals do not have interactivity');
|
assert.ok(!res.locals.hasOwnProperty('interactivity'), 'response locals do not have interactivity');
|
||||||
assert.equal(res.locals.dbname, test_database);
|
assert.equal(res.locals.dbname, test_database);
|
||||||
assert.ok(res.locals.dbuser === test_pubuser, 'could inject dbuser ('+res.locals.dbuser+')');
|
assert.ok(res.locals.dbuser === test_pubuser, 'could inject dbuser ('+res.locals.dbuser+')');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets also dbuser for authenticated requests', function(done){
|
it('sets also dbuser for authenticated requests', function(done){
|
||||||
|
Loading…
Reference in New Issue
Block a user