@@ -82,14 +82,13 @@ describe('isConversationRequest logic', () => {
8282 // Testing the logic that would be in isConversationRequest
8383 const isConversationRequest = ( method : string , pathname : string ) : boolean => {
8484 if ( method !== 'GET' ) return false ;
85- if ( ! pathname . startsWith ( '/backend-api/' ) ) return false ;
86- return true ;
85+ return / ^ \/ b a c k e n d - a p i \/ ( c o n v e r s a t i o n | s h a r e d _ c o n v e r s a t i o n ) \/ [ ^ / ] + \/ ? $ / . test ( pathname ) ;
8786 } ;
8887
89- it ( 'returns true for GET /backend-api/ requests ' , ( ) => {
88+ it ( 'returns true only for conversation endpoints ' , ( ) => {
9089 expect ( isConversationRequest ( 'GET' , '/backend-api/conversation/123' ) ) . toBe ( true ) ;
91- expect ( isConversationRequest ( 'GET' , '/backend-api/conversation' ) ) . toBe ( true ) ;
92- expect ( isConversationRequest ( 'GET' , '/backend-api/' ) ) . toBe ( true ) ;
90+ expect ( isConversationRequest ( 'GET' , '/backend-api/conversation/123/ ' ) ) . toBe ( true ) ;
91+ expect ( isConversationRequest ( 'GET' , '/backend-api/shared_conversation/abc-xyz ' ) ) . toBe ( true ) ;
9392 } ) ;
9493
9594 it ( 'returns false for non-GET methods' , ( ) => {
@@ -98,6 +97,16 @@ describe('isConversationRequest logic', () => {
9897 expect ( isConversationRequest ( 'DELETE' , '/backend-api/conversation' ) ) . toBe ( false ) ;
9998 } ) ;
10099
100+ it ( 'returns false for non-conversation backend-api paths' , ( ) => {
101+ expect ( isConversationRequest ( 'GET' , '/backend-api/' ) ) . toBe ( false ) ;
102+ expect ( isConversationRequest ( 'GET' , '/backend-api/conversation' ) ) . toBe ( false ) ;
103+ expect ( isConversationRequest ( 'GET' , '/backend-api/me' ) ) . toBe ( false ) ;
104+ expect ( isConversationRequest ( 'GET' , '/backend-api/settings/user' ) ) . toBe ( false ) ;
105+ expect ( isConversationRequest ( 'GET' , '/backend-api/models' ) ) . toBe ( false ) ;
106+ expect ( isConversationRequest ( 'GET' , '/backend-api/conversation/123/stream_status' ) ) . toBe ( false ) ;
107+ expect ( isConversationRequest ( 'GET' , '/backend-api/conversation/123/textdocs' ) ) . toBe ( false ) ;
108+ } ) ;
109+
101110 it ( 'returns false for non-backend-api paths' , ( ) => {
102111 expect ( isConversationRequest ( 'GET' , '/api/conversation' ) ) . toBe ( false ) ;
103112 expect ( isConversationRequest ( 'GET' , '/conversation' ) ) . toBe ( false ) ;
0 commit comments