Skip to content

Commit 4c572a7

Browse files
committed
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 jquerygh-4764 Ref jquerygh-4754 (cherry picked from commit df6858d)
1 parent 4f016c6 commit 4c572a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/middleware-mockserver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var mocks = {
9898
} else if ( req.query.callback ) {
9999
callback = Promise.resolve( req.query.callback );
100100
} else if ( req.method === "GET" ) {
101-
callback = Promise.resolve( req.url.match( /^.+\/([^\/?.]+)\?.+$/ )[ 1 ] );
101+
callback = Promise.resolve( req.url.match( /^.+\/([^\/?]+)\?.+$/ )[ 1 ] );
102102
} else {
103103
callback = getBody( req ).then( function( body ) {
104104
return body.trim().replace( "callback=", "" );

0 commit comments

Comments
 (0)