forked from EduCraft/curriculum-project-hub
fix: provide capability for both SDK auth modes
This commit is contained in:
@@ -52,9 +52,10 @@ describe("run-scoped provider proxy", () => {
|
||||
expect(serializedAgentEnv).not.toContain(String(address.port));
|
||||
expect(lease.sdkEnv).toMatchObject({
|
||||
ANTHROPIC_BASE_URL: expect.stringMatching(/^http:\/\/127\.0\.0\.1:\d+$/),
|
||||
ANTHROPIC_AUTH_TOKEN: "",
|
||||
ANTHROPIC_AUTH_TOKEN: expect.any(String),
|
||||
ANTHROPIC_API_KEY: expect.any(String),
|
||||
});
|
||||
expect(lease.sdkEnv.ANTHROPIC_AUTH_TOKEN).toBe(lease.sdkEnv.ANTHROPIC_API_KEY);
|
||||
|
||||
const response = await fetch(`${lease.sdkEnv.ANTHROPIC_BASE_URL}/v1/messages`, {
|
||||
method: "POST",
|
||||
@@ -104,7 +105,11 @@ describe("run-scoped provider proxy", () => {
|
||||
|
||||
expect(response.status).toBe(401);
|
||||
expect(upstreamRequests).toBe(0);
|
||||
expect(diagnostics).toEqual([{ code: "provider_proxy_unauthorized", category: "authorization" }]);
|
||||
expect(diagnostics).toEqual([{
|
||||
code: "provider_proxy_unauthorized",
|
||||
category: "authorization",
|
||||
authShape: { bearerLength: 0, apiKeyLength: 0, expectedLength: 43 },
|
||||
}]);
|
||||
});
|
||||
|
||||
it("accepts the run capability in the Anthropic x-api-key header", async () => {
|
||||
|
||||
Reference in New Issue
Block a user