aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2021-12-01 12:46:17 +0100
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2021-12-01 13:25:43 +0100
commit7439e221c02abe6690b38afece519f830481e179 (patch)
tree68979cae29469b73e26dcd4812480ee082f55763
parentb39cfa1505f5ccce28a4a83d8700f0edb3e9cd8c (diff)
downloadjquery-7439e221c02abe6690b38afece519f830481e179.tar.gz
jquery-7439e221c02abe6690b38afece519f830481e179.zip
Tests: Allow statusText to be "success" in AJAX tests
In HTTP/2, status message is not supported and whatever is reported as statusText differs between browsers. In Chrome & Safari it's "success", in Firefox & IE it's "OK". So far "success" wasn't allowed. This made the tests pass locally if you're running an HTTP/1.1 server but on TestSwarm which is now proxied via an HTTP/2-equipped Cloudflare, the relevant test started failing in Chrome & Safari. Allow "success" to resolve the issue. Closes gh-4973 (cherry picked from commit 19ced963c63372eae5aca9e1a4baec80b78a2b8e)
-rw-r--r--test/unit/ajax.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index bcb234640..dee96b36d 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -1627,7 +1627,8 @@ QUnit.module( "ajax", {
var done = assert.async();
jQuery.ajax( url( "mock.php?action=status&code=200&text=Hello" ) ).done( function( _, statusText, jqXHR ) {
assert.strictEqual( statusText, "success", "callback status text ok for success" );
- assert.ok( jqXHR.statusText === "Hello" || jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" );
+ assert.ok( [ "Hello", "OK", "success" ].indexOf( jqXHR.statusText ) > -1,
+ "jqXHR status text ok for success (" + jqXHR.statusText + ")" );
jQuery.ajax( url( "mock.php?action=status&code=404&text=World" ) ).fail( function( jqXHR, statusText ) {
assert.strictEqual( statusText, "error", "callback status text ok for error" );
done();