Merge branch 'b1.10'
Fixes bogus caching of failing jsonp responses
This commit is contained in:
commit
dff0a2aa1f
7
NEWS.md
7
NEWS.md
@ -1,6 +1,13 @@
|
||||
1.11.0 -- 2014-MM-DD
|
||||
--------------------
|
||||
|
||||
1.10.1 -- 2014-03-21
|
||||
-------------------
|
||||
|
||||
Bug fixes:
|
||||
|
||||
- Do not cache non-success jsonp responses (#186)
|
||||
|
||||
1.10.0 -- 2014-03-20
|
||||
--------------------
|
||||
|
||||
|
@ -76,9 +76,14 @@ var CartodbWindshaft = function(serverOptions) {
|
||||
var that = this;
|
||||
var thatArgs = arguments;
|
||||
var statusCode;
|
||||
if ( args.length > 2 ) statusCode = args[2];
|
||||
else {
|
||||
statusCode = args[1] || 200;
|
||||
if ( res._windshaftStatusCode ) {
|
||||
// Added by our override of sendError
|
||||
statusCode = res._windshaftStatusCode;
|
||||
} else {
|
||||
if ( args.length > 2 ) statusCode = args[2];
|
||||
else {
|
||||
statusCode = args[1] || 200;
|
||||
}
|
||||
}
|
||||
var req = res.req;
|
||||
Step (
|
||||
@ -117,6 +122,14 @@ var CartodbWindshaft = function(serverOptions) {
|
||||
);
|
||||
};
|
||||
|
||||
var ws_sendError = ws.sendError;
|
||||
ws.sendError = function() {
|
||||
var res = arguments[0];
|
||||
var statusCode = arguments[2];
|
||||
res._windshaftStatusCode = statusCode;
|
||||
ws_sendError.apply(this, arguments);
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to allow access to the layer to be used in the maps infowindow popup.
|
||||
*/
|
||||
|
@ -620,6 +620,24 @@ suite('server', function() {
|
||||
});
|
||||
});
|
||||
|
||||
// See http://github.com/CartoDB/Windshaft-cartodb/issues/186
|
||||
test("get'ing the grid of a private table should fail when unauthenticated (jsonp)",
|
||||
function(done) {
|
||||
assert.response(server, {
|
||||
headers: {host: 'localhost'},
|
||||
url: '/tiles/test_table_private_1/6/31/24.grid.json?callback=x',
|
||||
method: 'GET'
|
||||
},{}, function(res) {
|
||||
// It's forbidden, but jsonp calls for status = 200
|
||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||
// Still, we do NOT want to add caching headers here
|
||||
// See https://github.com/CartoDB/Windshaft-cartodb/issues/186
|
||||
assert.ok(!res.headers.hasOwnProperty('cache-control'),
|
||||
"Unexpected Cache-Control: " + res.headers['cache-control']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
// See http://github.com/Vizzuality/Windshaft-cartodb/issues/55
|
||||
test("get'ing grid of private table should fail on unknown username",
|
||||
function(done) {
|
||||
|
Loading…
Reference in New Issue
Block a user