Do not cache non-success jsonp responses

Closes #186
Includes testcase
This commit is contained in:
Sandro Santilli
2014-03-21 13:58:20 +01:00
parent 898f717254
commit 9e495b42ee
3 changed files with 38 additions and 3 deletions
+16 -3
View File
@@ -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.
*/