{"record":{"id":"bd9e0d934db61521","repo":"BigPizzaV3/CodexPlusPlus","slug":"llm-bridge-post","errorCode":null,"errorMessage":"LLM Bridge 仅支持 POST 请求","messagePattern":"LLM Bridge 仅支持 POST 请求","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/routes.rs","lineNumber":719,"sourceCode":"    let settings = crate::stepwise::settings_with_payload(result?, &payload);\n    crate::stepwise::test_connection(&settings).await\n}\n\nasync fn llm_proxy_value(payload: Value) -> anyhow::Result<Value> {\n    let url = validate_llm_proxy_url(\n        payload\n            .get(\"url\")\n            .and_then(Value::as_str)\n            .unwrap_or_default(),\n    )?;\n    let method = payload\n        .get(\"method\")\n        .and_then(Value::as_str)\n        .map(str::trim)\n        .filter(|value| !value.is_empty())\n        .unwrap_or(\"POST\");\n    if !method.eq_ignore_ascii_case(\"POST\") {\n        anyhow::bail!(\"LLM Bridge 仅支持 POST 请求\");\n    }\n\n    let timeout_ms = payload\n        .get(\"timeout_ms\")\n        .and_then(Value::as_u64)\n        .unwrap_or(60_000)\n        .clamp(1_000, 60_000);\n    let body = payload\n        .get(\"body\")\n        .and_then(Value::as_str)\n        .unwrap_or_default()\n        .to_string();\n    if body.len() > 1_048_576 {\n        anyhow::bail!(\"LLM Bridge 请求体过大\");\n    }\n\n    let client = reqwest::Client::builder()\n        .timeout(std::time::Duration::from_millis(timeout_ms))","sourceCodeStart":701,"sourceCodeEnd":737,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/routes.rs#L701-L737","documentation":"llm_proxy_value in the LLM Bridge HTTP handler only proxies POST requests. The method is read from the payload's \"method\" field (defaulting to \"POST\"), and any explicitly supplied non-POST method aborts the bridge call.","triggerScenarios":"Sending a bridge request whose JSON payload contains \"method\": \"GET\"/\"PUT\"/\"DELETE\" (or any non-POST value) to llm_proxy_value via handle_bridge_request.","commonSituations":"Client reuses a generic proxy wrapper that forwards the original HTTP verb; a health-check probe sends GET through the bridge; typo like \"post\" is fine (case-insensitive) but \"PATCH\" is not.","solutions":["Change the request to POST (or omit the \"method\" field, which defaults to POST)","Move non-POST operations outside the LLM Bridge","If a downstream API needs another verb, wrap it server-side behind a POST endpoint"],"exampleFix":"// before\n{ \"method\": \"GET\", \"url\": \"https://api.example.com/v1/models\", \"body\": \"\" }\n// after\n{ \"method\": \"POST\", \"url\": \"https://api.example.com/v1/chat/completions\", \"body\": \"{\\\"model\\\":\\\"...\\\"}\" }","handlingStrategy":"validation","validationCode":"const BRIDGE_METHOD: &str = \"POST\";\nfn bridge_payload(url: &str, body: &str) -> serde_json::Value {\n    serde_json::json!({ \"method\": \"POST\", \"url\": url, \"body\": body })\n}","typeGuard":null,"tryCatchPattern":"match llm_proxy_value(payload).await {\n    Err(e) if e.to_string().contains(\"仅支持 POST\") => {\n        payload[\"method\"] = serde_json::json!(\"POST\");\n        retry(payload)\n    }\n    other => other,\n}","preventionTips":["Omit the \"method\" field entirely — it defaults to POST","Never feed arbitrary HTTP verbs into the bridge","Add a client-side assert that bridge requests are POST"],"tags":["http","validation","llm-bridge"],"backgroundTag":"unsupported-operation","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}