Cover hash-over-credential validation precedence
Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
@@ -774,6 +774,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not include query parameters or hash fragments");
|
||||
});
|
||||
|
||||
it("prioritizes hash validation over credential validation", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "https://user:pass@example.com/base#fragment",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must not include query parameters or hash fragments");
|
||||
});
|
||||
|
||||
it("throws when trimmed baseURL includes username or password credentials", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -3145,6 +3156,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not include query parameters or hash fragments");
|
||||
});
|
||||
|
||||
it("prioritizes hash validation over credential validation in factory", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "https://user:pass@example.com/base#fragment",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must not include query parameters or hash fragments");
|
||||
});
|
||||
|
||||
it("throws from factory when trimmed baseURL includes username or password credentials", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
|
||||
Reference in New Issue
Block a user