Skip to content

Commit be5487f

Browse files
Cover hash-over-credential validation precedence
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 8309d57 commit be5487f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/ai/src/chatTransport.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,17 @@ describe("TriggerChatTransport", function () {
774774
}).toThrowError("baseURL must not include query parameters or hash fragments");
775775
});
776776

777+
it("prioritizes hash validation over credential validation", function () {
778+
expect(function () {
779+
new TriggerChatTransport({
780+
task: "chat-task",
781+
accessToken: "pk_trigger",
782+
baseURL: "https://user:pass@example.com/base#fragment",
783+
stream: "chat-stream",
784+
});
785+
}).toThrowError("baseURL must not include query parameters or hash fragments");
786+
});
787+
777788
it("throws when trimmed baseURL includes username or password credentials", function () {
778789
expect(function () {
779790
new TriggerChatTransport({
@@ -3145,6 +3156,17 @@ describe("TriggerChatTransport", function () {
31453156
}).toThrowError("baseURL must not include query parameters or hash fragments");
31463157
});
31473158

3159+
it("prioritizes hash validation over credential validation in factory", function () {
3160+
expect(function () {
3161+
createTriggerChatTransport({
3162+
task: "chat-task",
3163+
accessToken: "pk_trigger",
3164+
baseURL: "https://user:pass@example.com/base#fragment",
3165+
stream: "chat-stream",
3166+
});
3167+
}).toThrowError("baseURL must not include query parameters or hash fragments");
3168+
});
3169+
31483170
it("throws from factory when trimmed baseURL includes username or password credentials", function () {
31493171
expect(function () {
31503172
createTriggerChatTransport({

0 commit comments

Comments
 (0)