Skip to content

Commit 43cf6c9

Browse files
Cover percent-encoded delimiter paths in baseURL validation
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 6363e7e commit 43cf6c9

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
@@ -667,6 +667,7 @@ Examples:
667667
-`https://api.trigger.dev/custom-prefix`
668668
-` https://api.trigger.dev/custom-prefix/// ` (trimmed + normalized)
669669
-`https://api.trigger.dev/custom%20prefix` (percent-encoded whitespace)
670+
-`https://api.trigger.dev/custom%3Fprefix%23segment` (percent-encoded `?` / `#`)
670671
-`https://api.trigger.dev?foo=bar`
671672
-`https://api.trigger.dev#fragment`
672673
-`https://user:pass@api.trigger.dev`

packages/ai/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Examples:
174174
-`https://api.trigger.dev/custom-prefix`
175175
-` https://api.trigger.dev/custom-prefix/// ` (trimmed + normalized)
176176
-`https://api.trigger.dev/custom%20prefix` (percent-encoded whitespace)
177+
-`https://api.trigger.dev/custom%3Fprefix%23segment` (percent-encoded `?` / `#`)
177178
-`https://api.trigger.dev?foo=bar` (query string)
178179
-`https://api.trigger.dev#fragment` (hash fragment)
179180
-`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
@@ -984,6 +984,17 @@ describe("TriggerChatTransport", function () {
984984
}).not.toThrow();
985985
});
986986

987+
it("accepts percent-encoded query and hash markers in baseURL paths", function () {
988+
expect(function () {
989+
new TriggerChatTransport({
990+
task: "chat-task",
991+
accessToken: "pk_trigger",
992+
baseURL: "https://api.trigger.dev/custom%3Fprefix%23segment",
993+
stream: "chat-stream",
994+
});
995+
}).not.toThrow();
996+
});
997+
987998
it("accepts whitespace-wrapped uppercase http protocol in baseURL", function () {
988999
expect(function () {
9891000
new TriggerChatTransport({
@@ -3547,6 +3558,17 @@ describe("TriggerChatTransport", function () {
35473558
}).not.toThrow();
35483559
});
35493560

3561+
it("accepts percent-encoded query and hash markers in baseURL paths from factory", function () {
3562+
expect(function () {
3563+
createTriggerChatTransport({
3564+
task: "chat-task",
3565+
accessToken: "pk_trigger",
3566+
baseURL: "https://api.trigger.dev/custom%3Fprefix%23segment",
3567+
stream: "chat-stream",
3568+
});
3569+
}).not.toThrow();
3570+
});
3571+
35503572
it("accepts uppercase http protocol from factory without throwing", function () {
35513573
expect(function () {
35523574
createTriggerChatTransport({

0 commit comments

Comments
 (0)