Skip to content

Commit fb71d5a

Browse files
Cover word-joiner wrapper baseURL rejection
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 2df81ff commit fb71d5a

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docs/tasks/streams.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ Examples:
669669
-`https://api.trigger.dev/custom%20prefix` (percent-encoded whitespace)
670670
-`https://api.trigger.dev/custom%3Fprefix%23segment` (percent-encoded `?` / `#`)
671671
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
672+
-`\u2060https://api.trigger.dev/custom-prefix/\u2060` (word-joiner wrappers are rejected)
672673
-`https://api.trigger.dev?foo=bar`
673674
-`https://api.trigger.dev#fragment`
674675
-`https://user:pass@api.trigger.dev`

packages/ai/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ Examples:
176176
-`https://api.trigger.dev/custom%20prefix` (percent-encoded whitespace)
177177
-`https://api.trigger.dev/custom%3Fprefix%23segment` (percent-encoded `?` / `#`)
178178
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
179+
-`\u2060https://api.trigger.dev/custom-prefix/\u2060` (word-joiner wrappers are rejected)
179180
-`https://api.trigger.dev?foo=bar` (query string)
180181
-`https://api.trigger.dev#fragment` (hash fragment)
181182
-`https://user:pass@api.trigger.dev` (credentials)

packages/ai/src/chatTransport.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,17 @@ describe("TriggerChatTransport", function () {
874874
}).toThrowError("baseURL must not contain internal whitespace characters");
875875
});
876876

877+
it("throws when baseURL is wrapped with word-joiner characters", function () {
878+
expect(function () {
879+
new TriggerChatTransport({
880+
task: "chat-task",
881+
accessToken: "pk_trigger",
882+
baseURL: "\u2060https://api.trigger.dev/custom-prefix/\u2060",
883+
stream: "chat-stream",
884+
});
885+
}).toThrowError("baseURL must not contain internal whitespace characters");
886+
});
887+
877888
it("throws when baseURL contains internal BOM characters", function () {
878889
expect(function () {
879890
new TriggerChatTransport({
@@ -3646,6 +3657,17 @@ describe("TriggerChatTransport", function () {
36463657
}).toThrowError("baseURL must not contain internal whitespace characters");
36473658
});
36483659

3660+
it("throws from factory when baseURL is wrapped with word-joiner characters", function () {
3661+
expect(function () {
3662+
createTriggerChatTransport({
3663+
task: "chat-task",
3664+
accessToken: "pk_trigger",
3665+
baseURL: "\u2060https://api.trigger.dev/custom-prefix/\u2060",
3666+
stream: "chat-stream",
3667+
});
3668+
}).toThrowError("baseURL must not contain internal whitespace characters");
3669+
});
3670+
36493671
it("throws from factory when baseURL contains internal BOM characters", function () {
36503672
expect(function () {
36513673
createTriggerChatTransport({

0 commit comments

Comments
 (0)