@@ -653,6 +653,28 @@ describe("TriggerChatTransport", function () {
653653 } ) . toThrowError ( "baseURL must use http or https protocol" ) ;
654654 } ) ;
655655
656+ it ( "throws when baseURL includes query parameters" , function ( ) {
657+ expect ( function ( ) {
658+ new TriggerChatTransport ( {
659+ task : "chat-task" ,
660+ accessToken : "pk_trigger" ,
661+ baseURL : "https://example.com/base?query=1" ,
662+ stream : "chat-stream" ,
663+ } ) ;
664+ } ) . toThrowError ( "baseURL must not include query parameters or hash fragments" ) ;
665+ } ) ;
666+
667+ it ( "throws when baseURL includes hash fragments" , function ( ) {
668+ expect ( function ( ) {
669+ new TriggerChatTransport ( {
670+ task : "chat-task" ,
671+ accessToken : "pk_trigger" ,
672+ baseURL : "https://example.com/base#fragment" ,
673+ stream : "chat-stream" ,
674+ } ) ;
675+ } ) . toThrowError ( "baseURL must not include query parameters or hash fragments" ) ;
676+ } ) ;
677+
656678 it ( "accepts uppercase http protocol in baseURL" , async function ( ) {
657679 let observedTriggerPath : string | undefined ;
658680 let observedStreamPath : string | undefined ;
@@ -2870,6 +2892,28 @@ describe("TriggerChatTransport", function () {
28702892 } ) . toThrowError ( "baseURL must use http or https protocol" ) ;
28712893 } ) ;
28722894
2895+ it ( "throws from factory when baseURL includes query parameters" , function ( ) {
2896+ expect ( function ( ) {
2897+ createTriggerChatTransport ( {
2898+ task : "chat-task" ,
2899+ accessToken : "pk_trigger" ,
2900+ baseURL : "https://example.com/base?query=1" ,
2901+ stream : "chat-stream" ,
2902+ } ) ;
2903+ } ) . toThrowError ( "baseURL must not include query parameters or hash fragments" ) ;
2904+ } ) ;
2905+
2906+ it ( "throws from factory when baseURL includes hash fragments" , function ( ) {
2907+ expect ( function ( ) {
2908+ createTriggerChatTransport ( {
2909+ task : "chat-task" ,
2910+ accessToken : "pk_trigger" ,
2911+ baseURL : "https://example.com/base#fragment" ,
2912+ stream : "chat-stream" ,
2913+ } ) ;
2914+ } ) . toThrowError ( "baseURL must not include query parameters or hash fragments" ) ;
2915+ } ) ;
2916+
28732917 it ( "continues streaming when onTriggeredRun callback throws" , async function ( ) {
28742918 let callbackCalled = false ;
28752919 const errors : TriggerChatTransportError [ ] = [ ] ;
0 commit comments