Skip to content

Commit 6363e7e

Browse files
Cover percent-encoded whitespace baseURL acceptance
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 6e8c236 commit 6363e7e

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
@@ -666,6 +666,7 @@ Examples:
666666
-`https://api.trigger.dev`
667667
-`https://api.trigger.dev/custom-prefix`
668668
-` https://api.trigger.dev/custom-prefix/// ` (trimmed + normalized)
669+
-`https://api.trigger.dev/custom%20prefix` (percent-encoded whitespace)
669670
-`https://api.trigger.dev?foo=bar`
670671
-`https://api.trigger.dev#fragment`
671672
-`https://user:pass@api.trigger.dev`

packages/ai/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ Examples:
173173
-`https://api.trigger.dev`
174174
-`https://api.trigger.dev/custom-prefix`
175175
-` https://api.trigger.dev/custom-prefix/// ` (trimmed + normalized)
176+
-`https://api.trigger.dev/custom%20prefix` (percent-encoded whitespace)
176177
-`https://api.trigger.dev?foo=bar` (query string)
177178
-`https://api.trigger.dev#fragment` (hash fragment)
178179
-`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
@@ -973,6 +973,17 @@ describe("TriggerChatTransport", function () {
973973
}).not.toThrow();
974974
});
975975

976+
it("accepts percent-encoded whitespace in baseURL paths", function () {
977+
expect(function () {
978+
new TriggerChatTransport({
979+
task: "chat-task",
980+
accessToken: "pk_trigger",
981+
baseURL: "https://api.trigger.dev/custom%20prefix",
982+
stream: "chat-stream",
983+
});
984+
}).not.toThrow();
985+
});
986+
976987
it("accepts whitespace-wrapped uppercase http protocol in baseURL", function () {
977988
expect(function () {
978989
new TriggerChatTransport({
@@ -3525,6 +3536,17 @@ describe("TriggerChatTransport", function () {
35253536
}).not.toThrow();
35263537
});
35273538

3539+
it("accepts percent-encoded whitespace in baseURL paths from factory", function () {
3540+
expect(function () {
3541+
createTriggerChatTransport({
3542+
task: "chat-task",
3543+
accessToken: "pk_trigger",
3544+
baseURL: "https://api.trigger.dev/custom%20prefix",
3545+
stream: "chat-stream",
3546+
});
3547+
}).not.toThrow();
3548+
});
3549+
35283550
it("accepts uppercase http protocol from factory without throwing", function () {
35293551
expect(function () {
35303552
createTriggerChatTransport({

0 commit comments

Comments
 (0)