@@ -752,6 +752,28 @@ describe("TriggerChatTransport", function () {
752752 } ) . toThrowError ( "baseURL must not include username or password credentials" ) ;
753753 } ) ;
754754
755+ it ( "prioritizes protocol validation over query/hash validation" , function ( ) {
756+ expect ( function ( ) {
757+ new TriggerChatTransport ( {
758+ task : "chat-task" ,
759+ accessToken : "pk_trigger" ,
760+ baseURL : "ftp://example.com/base?query=1" ,
761+ stream : "chat-stream" ,
762+ } ) ;
763+ } ) . toThrowError ( "baseURL must use http or https protocol" ) ;
764+ } ) ;
765+
766+ it ( "prioritizes query/hash validation over credential validation" , function ( ) {
767+ expect ( function ( ) {
768+ new TriggerChatTransport ( {
769+ task : "chat-task" ,
770+ accessToken : "pk_trigger" ,
771+ baseURL : "https://user:pass@example.com/base?query=1" ,
772+ stream : "chat-stream" ,
773+ } ) ;
774+ } ) . toThrowError ( "baseURL must not include query parameters or hash fragments" ) ;
775+ } ) ;
776+
755777 it ( "throws when trimmed baseURL includes username or password credentials" , function ( ) {
756778 expect ( function ( ) {
757779 new TriggerChatTransport ( {
@@ -3101,6 +3123,28 @@ describe("TriggerChatTransport", function () {
31013123 } ) . toThrowError ( "baseURL must not include username or password credentials" ) ;
31023124 } ) ;
31033125
3126+ it ( "prioritizes protocol validation over query/hash validation in factory" , function ( ) {
3127+ expect ( function ( ) {
3128+ createTriggerChatTransport ( {
3129+ task : "chat-task" ,
3130+ accessToken : "pk_trigger" ,
3131+ baseURL : "ftp://example.com/base?query=1" ,
3132+ stream : "chat-stream" ,
3133+ } ) ;
3134+ } ) . toThrowError ( "baseURL must use http or https protocol" ) ;
3135+ } ) ;
3136+
3137+ it ( "prioritizes query/hash validation over credential validation in factory" , function ( ) {
3138+ expect ( function ( ) {
3139+ createTriggerChatTransport ( {
3140+ task : "chat-task" ,
3141+ accessToken : "pk_trigger" ,
3142+ baseURL : "https://user:pass@example.com/base?query=1" ,
3143+ stream : "chat-stream" ,
3144+ } ) ;
3145+ } ) . toThrowError ( "baseURL must not include query parameters or hash fragments" ) ;
3146+ } ) ;
3147+
31043148 it ( "throws from factory when trimmed baseURL includes username or password credentials" , function ( ) {
31053149 expect ( function ( ) {
31063150 createTriggerChatTransport ( {
0 commit comments