Skip to content

Commit 666b991

Browse files
Cover trimmed wrapper query/hash validation path
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent c82bf64 commit 666b991

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

844+
it("throws query/hash validation after trimming wrapper whitespace", function () {
845+
expect(function () {
846+
new TriggerChatTransport({
847+
task: "chat-task",
848+
accessToken: "pk_trigger",
849+
baseURL: " https://api.trigger.dev/base?query=1 ",
850+
stream: "chat-stream",
851+
});
852+
}).toThrowError("baseURL must not include query parameters or hash fragments");
853+
});
854+
844855
it("throws when baseURL includes hash fragments", function () {
845856
expect(function () {
846857
new TriggerChatTransport({
@@ -3426,6 +3437,17 @@ describe("TriggerChatTransport", function () {
34263437
}).toThrowError("baseURL must not include query parameters or hash fragments");
34273438
});
34283439

3440+
it("throws query/hash validation after trimming wrapper whitespace in factory", function () {
3441+
expect(function () {
3442+
createTriggerChatTransport({
3443+
task: "chat-task",
3444+
accessToken: "pk_trigger",
3445+
baseURL: " https://api.trigger.dev/base?query=1 ",
3446+
stream: "chat-stream",
3447+
});
3448+
}).toThrowError("baseURL must not include query parameters or hash fragments");
3449+
});
3450+
34293451
it("throws from factory when baseURL includes hash fragments", function () {
34303452
expect(function () {
34313453
createTriggerChatTransport({

0 commit comments

Comments
 (0)