Cover newline-tab wrapped websocket protocol validation
Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
@@ -689,6 +689,7 @@ Examples:
|
||||
- ❌ `\u205F///\u205F` (empty after trimming wrapper whitespace)
|
||||
- ❌ `\u3000///\u3000` (empty after trimming wrapper whitespace)
|
||||
- ❌ `\n\thttps://api.trigger.dev/base/?query=1\t\n` (query is still rejected after trimming wrappers)
|
||||
- ❌ `\n\tws://api.trigger.dev\t\n` / `\n\twss://api.trigger.dev\t\n` (trimmed wrappers still reject websocket protocols)
|
||||
- ❌ `https://api.trigger.dev/\ninternal`
|
||||
- ❌ `https://api.trigger.dev/in valid`
|
||||
- ❌ `https://api.trigger.dev/\tinternal`
|
||||
|
||||
@@ -196,6 +196,7 @@ Examples:
|
||||
- ❌ `\u205F///\u205F` (empty after trimming wrapper whitespace)
|
||||
- ❌ `\u3000///\u3000` (empty after trimming wrapper whitespace)
|
||||
- ❌ `\n\thttps://api.trigger.dev/base/?query=1\t\n` (query is still rejected after trimming wrappers)
|
||||
- ❌ `\n\tws://api.trigger.dev\t\n` / `\n\twss://api.trigger.dev\t\n` (trimmed wrappers still reject websocket protocols)
|
||||
- ❌ `https://api.trigger.dev/\ninternal` (internal whitespace characters)
|
||||
- ❌ `https://api.trigger.dev/in valid` (internal space characters)
|
||||
- ❌ `https://api.trigger.dev/\tinternal` (internal tab characters)
|
||||
|
||||
@@ -1061,6 +1061,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws when newline-and-tab wrapped baseURL protocol is ws", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\n\tws://example.com\t\n",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws when baseURL protocol is wss", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -1083,6 +1094,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws when newline-and-tab wrapped baseURL protocol is wss", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\n\twss://example.com\t\n",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws when baseURL includes query parameters", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -4053,6 +4075,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws from factory when newline-and-tab wrapped baseURL protocol is ws", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\n\tws://example.com\t\n",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws from factory when baseURL protocol is wss", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
@@ -4075,6 +4108,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws from factory when newline-and-tab wrapped baseURL protocol is wss", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\n\twss://example.com\t\n",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws from factory when baseURL includes query parameters", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
|
||||
Reference in New Issue
Block a user