@@ -76,6 +76,7 @@ class AllTests
7676 this . _serverAuthorizeAllPlugin = new JSONRPC . Plugins . Server . AuthorizeAll ( ) ;
7777
7878 this . _bWebSocketMode = ! ! bWebSocketMode ;
79+ this . _bPreventHTTPAPIRequests = false ;
7980
8081 Object . seal ( this ) ;
8182 }
@@ -86,6 +87,9 @@ class AllTests
8687 */
8788 async runTests ( )
8889 {
90+ this . _bPreventHTTPAPIRequests = this . _bWebSocketMode ;
91+
92+
8993 await this . triggerConnectionRefused ( ) ;
9094
9195
@@ -233,7 +237,7 @@ class AllTests
233237 return ;
234238 }
235239 else if (
236- this . _bWebSocketMode
240+ this . _bPreventHTTPAPIRequests
237241 && ! incomingRequest . headers [ "sec-websocket-version" ]
238242 && incomingRequest . method === "POST"
239243 && url . parse ( incomingRequest . url ) . pathname . substr ( 0 , 4 ) === "/api"
@@ -510,8 +514,7 @@ class AllTests
510514 */
511515 async endpointNotFoundError ( )
512516 {
513- const bWebSocketMode = this . _bWebSocketMode ;
514- this . _bWebSocketMode = false ;
517+ this . _bPreventHTTPAPIRequests = false ;
515518
516519
517520 console . log ( "[" + process . pid + "] endpointNotFoundError" ) ;
@@ -538,7 +541,7 @@ class AllTests
538541 }
539542
540543
541- this . _bWebSocketMode = bWebSocketMode ;
544+ this . _bPreventHTTPAPIRequests = this . _bWebSocketMode ;
542545 }
543546
544547
0 commit comments