diff options
Diffstat (limited to 'test/data/mock.php')
-rw-r--r-- | test/data/mock.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/data/mock.php b/test/data/mock.php index b76fd521c..24302e6bc 100644 --- a/test/data/mock.php +++ b/test/data/mock.php @@ -54,7 +54,21 @@ class MockServer { } else { header( 'Content-type: text/html' ); } - echo 'QUnit.assert.ok( true, "mock executed" );'; + + if ( !empty( $req->query['cors'] ) ) { + header( "Access-Control-Allow-Origin: *" ); + } + + if ( !empty( $req->query['callback'] ) ) { + $headers = array_combine( + array_map( 'strtolower', array_keys( $req->headers ) ), + array_values( $req->headers ) + ); + + echo $req->query['callback'] . "(" . json_encode( [ 'headers' => $headers ] ) . ")"; + } else { + echo 'QUnit.assert.ok( true, "mock executed" );'; + } } // Used to be in test.js, but was renamed to testbar.php |