Skip to content

Commit

Permalink
Tests: Recognize callbacks with dots in the Node.js mock server
Browse files Browse the repository at this point in the history
This aligns the Node.js server with the previous PHP one in accepting `mock.php`
as a callback 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
```

Ref jquerygh-4754
  • Loading branch information
mgol committed Jul 29, 2020
1 parent a22b43b commit 446c05c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/middleware-mockserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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=", "" );
Expand Down

0 comments on commit 446c05c

Please sign in to comment.