FIX: Raise errors for broken pretender responses in test mode

This commit is contained in:
Robin Ward 2020-08-05 14:41:40 -04:00
parent aa017f276f
commit b0564205d9
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import logout from "discourse/lib/logout";
import Session from "discourse/models/session";
import { Promise } from "rsvp";
import Site from "discourse/models/site";
import { isTesting } from "discourse-common/config/environment";
let _trackView = false;
let _transientHeader = null;
@ -118,7 +119,9 @@ export function ajax() {
args.error = (xhr, textStatus, errorThrown) => {
// 0 represents the `UNSENT` state
if (xhr.readyState === 0) return;
if (xhr.readyState === 0 && !isTesting()) {
return;
}
handleLogoff(xhr);
// note: for bad CSRF we don't loop an extra request right away.