mirror of
https://github.com/musistudio/claude-code-router.git
synced 2026-07-09 17:18:24 +00:00
Relax protocol probe 400 validation handling
This commit is contained in:
parent
ab6a2c1c50
commit
088ec97e7b
2 changed files with 13 additions and 15 deletions
|
|
@ -1076,18 +1076,7 @@ function isProtocolSupported(
|
|||
if (/not found|unknown endpoint|unknown route|no route/.test(normalized)) {
|
||||
return false;
|
||||
}
|
||||
if (protocol === "openai_responses") {
|
||||
return /model|max_output|max output|input|required/.test(normalized);
|
||||
}
|
||||
if (protocol === "openai_chat_completions" || protocol === "anthropic_messages") {
|
||||
return /model|max_tokens|messages|required/.test(normalized);
|
||||
}
|
||||
if (protocol === "gemini_generate_content") {
|
||||
return /contents|generatecontentrequest|generationconfig/.test(normalized);
|
||||
}
|
||||
if (protocol === "gemini_interactions") {
|
||||
return /model|input|required|interaction|generation_config|generationconfig|system_instruction/.test(normalized);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ test("protocol support probe keeps auth-only fallback for unhinted endpoints", (
|
|||
);
|
||||
});
|
||||
|
||||
test("protocol support probe treats Gemini contents validation as Gemini support only", () => {
|
||||
test("protocol support probe treats HTTP 400 validation as protocol support", () => {
|
||||
const message = "HTTP 400: * GenerateContentRequest.contents: contents is not specified";
|
||||
|
||||
assert.equal(
|
||||
|
|
@ -52,11 +52,11 @@ test("protocol support probe treats Gemini contents validation as Gemini support
|
|||
);
|
||||
assert.equal(
|
||||
isProviderProtocolEndpointSupportedForProbe(400, message, "openai_chat_completions", ["openai_chat_completions"]),
|
||||
false
|
||||
true
|
||||
);
|
||||
});
|
||||
|
||||
test("protocol support probe treats Gemini Interactions input validation as Interactions support", () => {
|
||||
test("protocol support probe treats HTTP 400 input validation as protocol support", () => {
|
||||
const message = "HTTP 400: Gemini Interactions request requires input.";
|
||||
|
||||
assert.equal(
|
||||
|
|
@ -65,6 +65,15 @@ test("protocol support probe treats Gemini Interactions input validation as Inte
|
|||
);
|
||||
assert.equal(
|
||||
isProviderProtocolEndpointSupportedForProbe(400, message, "gemini_generate_content", ["gemini_generate_content"]),
|
||||
true
|
||||
);
|
||||
});
|
||||
|
||||
test("protocol support probe still rejects HTTP 400 route misses", () => {
|
||||
const message = "HTTP 400: unknown route";
|
||||
|
||||
assert.equal(
|
||||
isProviderProtocolEndpointSupportedForProbe(400, message, "openai_chat_completions", ["openai_chat_completions"]),
|
||||
false
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue