fix(native-api): 修复 Gemini :verb 路径中 %3A URL 编码导致上游 400 的兼容问题#237
Merged
Merged
Conversation
litellm 等客户端会将 Gemini 路径中的冒号 URL 编码为 %3A, 导致上游 API 无法识别 :batchEmbedContents 等 verb 后缀。 修复内容: - handler: dispatch() 中对 rest_path 做防御性 unquote() 解码 - operation: Gemini 正则模式兼容字面 : 与 %3A 两种形态 - 新增 batchEmbedContents 端到端测试及 %3A 编码路径测试 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
%3A时,代理透传至上游导致 400 Bad Request 的问题handler.dispatch()中添加防御性unquote(rest_path)解码,确保上游收到字面冒号OperationClassifier正则模式兼容字面:与%3A两种编码形态修改文件
src/coding/proxy/native_api/handler.py— dispatch() 中对 rest_path 做 unquote() 解码src/coding/proxy/native_api/operation.py— Gemini :verb 正则兼容%3Atests/test_native_api_handler.py— 新增 batchEmbedContents 及 %3A 端到端测试tests/test_native_api_operation.py— 新增 %3A 操作分类测试用例Test plan
🤖 Generated with Claude Code, CodeX, Gemini