Now return 404 to bad list request

This commit is contained in:
Remy Sharp 2014-08-04 17:06:11 +01:00
parent 4d4af1471c
commit 99c1d64b3b
2 changed files with 10 additions and 4 deletions

View File

@ -357,8 +357,8 @@ module.exports = Observable.extend({
if (!username) {
// FIXME tmp fix to kick out 404 infinite loop
return res.send('<meta http-equiv="refresh" content="0">');
// return next(404);
// return res.send('<meta http-equiv="refresh" content="0">');
return next(404);
}
// TODO: convert to promise

View File

@ -7,6 +7,7 @@
var $body = $('body'),
loaded = false,
requestAttempts = 5,
$history; // set in hookUserHistory()
$document.on('history:open', function () {
@ -31,8 +32,13 @@
dataType: 'html',
url: jsbin.root + '/list',
error: function () {
$('#history').remove();
setTimeout(loadList, 500);
requestAttempts--;
if (requestAttempts > 0) {
$('#history').remove();
setTimeout(loadList, 500);
} else {
console.error('Giving up to load history');
}
},
success: function (html) {
$('#history').remove();