Skip to content

Commit a70ecde

Browse files
Cover internal tab characters in baseURL validation
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 0aa2edb commit a70ecde

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
@@ -731,6 +731,17 @@ describe("TriggerChatTransport", function () {
731731
}).toThrowError("baseURL must not contain internal whitespace characters");
732732
});
733733

734+
it("throws when baseURL contains internal tab characters", function () {
735+
expect(function () {
736+
new TriggerChatTransport({
737+
task: "chat-task",
738+
accessToken: "pk_trigger",
739+
baseURL: "https://api.trigger.dev/\tinternal",
740+
stream: "chat-stream",
741+
});
742+
}).toThrowError("baseURL must not contain internal whitespace characters");
743+
});
744+
734745
it("throws when baseURL is a relative path", function () {
735746
expect(function () {
736747
new TriggerChatTransport({
@@ -3283,6 +3294,17 @@ describe("TriggerChatTransport", function () {
32833294
}).toThrowError("baseURL must not contain internal whitespace characters");
32843295
});
32853296

3297+
it("throws from factory when baseURL contains internal tab characters", function () {
3298+
expect(function () {
3299+
createTriggerChatTransport({
3300+
task: "chat-task",
3301+
accessToken: "pk_trigger",
3302+
baseURL: "https://api.trigger.dev/\tinternal",
3303+
stream: "chat-stream",
3304+
});
3305+
}).toThrowError("baseURL must not contain internal whitespace characters");
3306+
});
3307+
32863308
it("throws from factory when baseURL protocol is not http or https", function () {
32873309
expect(function () {
32883310
createTriggerChatTransport({

0 commit comments

Comments
 (0)