fix: update authorization header handling to prevent empty values and show validation error
This commit is contained in:
parent
17ace55bbf
commit
30f9855fd5
1 changed files with 28 additions and 9 deletions
|
|
@ -97,9 +97,10 @@ jest.mock("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
|||
}));
|
||||
|
||||
// Mock the toast hook
|
||||
const mockToast = jest.fn();
|
||||
jest.mock("@/lib/hooks/useToast", () => ({
|
||||
useToast: () => ({
|
||||
toast: jest.fn(),
|
||||
toast: mockToast,
|
||||
}),
|
||||
}));
|
||||
|
||||
|
|
@ -940,6 +941,13 @@ describe("useConnection", () => {
|
|||
expect(headers).toHaveProperty("Authorization", "Bearer mock-token");
|
||||
// Should not have the x-custom-auth-headers since Authorization is standard
|
||||
expect(headers).not.toHaveProperty("x-custom-auth-headers");
|
||||
|
||||
// Should show toast notification for empty Authorization header
|
||||
expect(mockToast).toHaveBeenCalledWith({
|
||||
title: "Invalid Authorization Header",
|
||||
description: expect.any(String),
|
||||
variant: "destructive",
|
||||
});
|
||||
});
|
||||
|
||||
test("prioritizes custom headers over legacy auth", async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue