Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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

(cherry picked from commit df6858d)
  • Loading branch information
mgol committed Sep 2, 2020
1 parent 4f016c6 commit 4c572a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/middleware-mockserver.js
Expand Up @@ -98,7 +98,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 4c572a7

Please sign in to comment.