fix: accept custom_body in URL-based create_pass_through_route endpoint_func#23412
Merged
krrishdholakia merged 1 commit intoBerriAI:mainfrom Mar 12, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR fixes a Key changes:
Note: This is a re-application of the identical fix from PR #20849 ( Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/pass_through_endpoints/pass_through_endpoints.py | Adds custom_body: Optional[dict] = None to the URL-based endpoint_func in create_pass_through_route, with correct precedence over request-parsed body; fixes the TypeError raised when bedrock_proxy_route passes custom_body=data. |
Sequence Diagram
sequenceDiagram
participant Client
participant bedrock_proxy_route
participant create_pass_through_route
participant endpoint_func (URL-based)
participant _parse_request_data_by_content_type
participant pass_through_request
Client->>bedrock_proxy_route: POST /bedrock/{endpoint}
bedrock_proxy_route->>bedrock_proxy_route: data = await request.json()
bedrock_proxy_route->>bedrock_proxy_route: SigV4-sign request body
bedrock_proxy_route->>create_pass_through_route: create_pass_through_route(endpoint, target, ...)
create_pass_through_route-->>bedrock_proxy_route: endpoint_func (URL-based)
bedrock_proxy_route->>endpoint_func (URL-based): await endpoint_func(..., custom_body=data)
Note over endpoint_func (URL-based): custom_body param now accepted ✅ (was TypeError before fix)
endpoint_func (URL-based)->>_parse_request_data_by_content_type: parse request (for query_params, etc.)
_parse_request_data_by_content_type-->>endpoint_func (URL-based): query_params_data, custom_body_data, ...
Note over endpoint_func (URL-based): custom_body != None → use caller-supplied body (takes precedence)
endpoint_func (URL-based)->>pass_through_request: pass_through_request(..., custom_body=data)
pass_through_request-->>Client: Forwarded response
Last reviewed commit: 8392967
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
create_pass_through_routehas twoendpoint_funcimplementations: one for adapter-based targets and one for URL-based targetsendpoint_funccorrectly acceptscustom_bodyin its signatureendpoint_func(theexceptbranch) was missingcustom_body, causing aTypeErrorwhen callers likebedrock_proxy_routepasscustom_body=datacustom_body: Optional[dict] = Noneto the URL-basedendpoint_funcsignature and give it precedence over the request-parsed bodyTest plan
test (proxy-misc)—test_create_pass_through_route_custom_body_url_targetpasses