aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2020-09-02 18:42:52 +0200
committerGitHub <noreply@github.com>2020-09-02 18:42:52 +0200
commitdf6858df2ed3fc5c424591a5e09b900eb4ce0417 (patch)
treeb0a7c53c4d880e1b689e13cfa79ec8da32546cf8 /test
parentc18dc49699bc27481a4af36ed1a0ee1b19c6eb03 (diff)
downloadjquery-df6858df2ed3fc5c424591a5e09b900eb4ce0417.tar.gz
jquery-df6858df2ed3fc5c424591a5e09b900eb4ce0417.zip
Tests: Recognize callbacks with dots in the Node.js mock server
This aligns the Node.js server with the previous PHP one in sending `mock.php` as a callback if there's no `callback` parameter in the query string which is triggered by a recently added test. This prevents the request crashing on that Node.js server and printing a JS error: ``` TypeError: Cannot read property '1' of null ``` Closes gh-4764 Ref gh-4754
Diffstat (limited to 'test')
-rw-r--r--test/middleware-mockserver.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/middleware-mockserver.js b/test/middleware-mockserver.js
index d0329eb9b..b3f630dd5 100644
--- a/test/middleware-mockserver.js
+++ b/test/middleware-mockserver.js
@@ -101,7 +101,7 @@ var mocks = {
} else if ( req.query.callback ) {
callback = Promise.resolve( req.query.callback );
} else if ( req.method === "GET" ) {
- callback = Promise.resolve( req.url.match( /^.+\/([^\/?.]+)\?.+$/ )[ 1 ] );
+ callback = Promise.resolve( req.url.match( /^.+\/([^\/?]+)\?.+$/ )[ 1 ] );
} else {
callback = getBody( req ).then( function( body ) {
return body.trim().replace( "callback=", "" );