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) {
|
||||
this.staticMap(
|
||||
req,
|
||||
res,
|
||||
+req.params.width,
|
||||
+req.params.height,
|
||||
{
|
||||
west: +req.params.west,
|
||||
north: +req.params.north,
|
||||
east: +req.params.east,
|
||||
south: +req.params.south
|
||||
},
|
||||
next
|
||||
);
|
||||
this.staticMap(req, res, +req.params.width, +req.params.height, {
|
||||
west: +req.params.west,
|
||||
north: +req.params.north,
|
||||
east: +req.params.east,
|
||||
south: +req.params.south
|
||||
}, next);
|
||||
};
|
||||
|
||||
LayergroupController.prototype.center = function(req, res, next) {
|
||||
this.staticMap(
|
||||
req,
|
||||
res,
|
||||
+req.params.width,
|
||||
+req.params.height,
|
||||
+req.params.z,
|
||||
{
|
||||
lng: +req.params.lng,
|
||||
lat: +req.params.lat
|
||||
},
|
||||
next
|
||||
);
|
||||
this.staticMap(req, res, +req.params.width, +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) {
|
||||
|
@ -73,33 +73,33 @@ describe('prepare-context', function() {
|
||||
});
|
||||
|
||||
it('cleans up request', function(done){
|
||||
var req = {headers: { host:'localhost' }, query: {dbuser:'hacker',dbname:'secret'}};
|
||||
var res = {};
|
||||
var req = {headers: { host:'localhost' }, query: {dbuser:'hacker',dbname:'secret'}};
|
||||
var res = {};
|
||||
|
||||
cleanUpQueryParams(prepareRequest(req), prepareResponse(res), function(err) {
|
||||
if ( err ) { done(err); return; }
|
||||
assert.ok(_.isObject(req.query), 'request has query');
|
||||
assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query');
|
||||
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
||||
assert.ok(!res.locals.hasOwnProperty('interactivity'), 'response locals do not have interactivity');
|
||||
done();
|
||||
});
|
||||
cleanUpQueryParams(prepareRequest(req), prepareResponse(res), function(err) {
|
||||
if ( err ) { done(err); return; }
|
||||
assert.ok(_.isObject(req.query), 'request has query');
|
||||
assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query');
|
||||
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
||||
assert.ok(!res.locals.hasOwnProperty('interactivity'), 'response locals do not have interactivity');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('sets dbname from redis metadata', function(done){
|
||||
var req = {headers: { host:'localhost' }, query: {} };
|
||||
var res = {};
|
||||
var req = {headers: { host:'localhost' }, query: {} };
|
||||
var res = {};
|
||||
|
||||
dbConnSetup(prepareRequest(req), prepareResponse(res), function(err) {
|
||||
if ( err ) { done(err); return; }
|
||||
assert.ok(_.isObject(req.query), 'request has query');
|
||||
assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query');
|
||||
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
||||
assert.ok(!res.locals.hasOwnProperty('interactivity'), 'response locals do not have interactivity');
|
||||
assert.equal(res.locals.dbname, test_database);
|
||||
assert.ok(res.locals.dbuser === test_pubuser, 'could inject dbuser ('+res.locals.dbuser+')');
|
||||
done();
|
||||
});
|
||||
dbConnSetup(prepareRequest(req), prepareResponse(res), function(err) {
|
||||
if ( err ) { done(err); return; }
|
||||
assert.ok(_.isObject(req.query), 'request has query');
|
||||
assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query');
|
||||
assert.ok(res.hasOwnProperty('locals'), 'response has locals');
|
||||
assert.ok(!res.locals.hasOwnProperty('interactivity'), 'response locals do not have interactivity');
|
||||
assert.equal(res.locals.dbname, test_database);
|
||||
assert.ok(res.locals.dbuser === test_pubuser, 'could inject dbuser ('+res.locals.dbuser+')');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('sets also dbuser for authenticated requests', function(done){
|
||||
|
Loading…
Reference in New Issue
Block a user