Skip to content

Commit 861e42a

Browse files
Cover trimmed query-bearing baseURL rejection paths
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent ae2942e commit 861e42a

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
@@ -664,6 +664,17 @@ describe("TriggerChatTransport", function () {
664664
}).toThrowError("baseURL must not include query parameters or hash fragments");
665665
});
666666

667+
it("throws when trimmed baseURL includes query parameters", function () {
668+
expect(function () {
669+
new TriggerChatTransport({
670+
task: "chat-task",
671+
accessToken: "pk_trigger",
672+
baseURL: " https://example.com/base/?query=1 ",
673+
stream: "chat-stream",
674+
});
675+
}).toThrowError("baseURL must not include query parameters or hash fragments");
676+
});
677+
667678
it("throws when baseURL includes hash fragments", function () {
668679
expect(function () {
669680
new TriggerChatTransport({
@@ -2925,6 +2936,17 @@ describe("TriggerChatTransport", function () {
29252936
}).toThrowError("baseURL must not include query parameters or hash fragments");
29262937
});
29272938

2939+
it("throws from factory when trimmed baseURL includes query parameters", function () {
2940+
expect(function () {
2941+
createTriggerChatTransport({
2942+
task: "chat-task",
2943+
accessToken: "pk_trigger",
2944+
baseURL: " https://example.com/base/?query=1 ",
2945+
stream: "chat-stream",
2946+
});
2947+
}).toThrowError("baseURL must not include query parameters or hash fragments");
2948+
});
2949+
29282950
it("throws from factory when baseURL includes hash fragments", function () {
29292951
expect(function () {
29302952
createTriggerChatTransport({

0 commit comments

Comments
 (0)