Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/vllm_router/services/request_service/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,13 @@ async def route_general_transcriptions(
headers = {
k: v
for k, v in backend_response.headers.items()
if k.lower() not in ("content-encoding", "transfer-encoding", "connection")
if k.lower()
not in (
"content-length",
"content-encoding",
"transfer-encoding",
"connection",
)
}
Comment on lines 656 to 666
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and maintainability, it's a good practice to define the set of excluded headers separately. Using a set is also more idiomatic and typically more performant for membership testing than a tuple.

Suggested change
headers = {
k: v
for k, v in backend_response.headers.items()
if k.lower() not in ("content-encoding", "transfer-encoding", "connection")
if k.lower()
not in (
"content-length",
"content-encoding",
"transfer-encoding",
"connection",
)
}
excluded_headers = {
"content-length",
"content-encoding",
"transfer-encoding",
"connection",
}
headers = {
k: v
for k, v in backend_response.headers.items()
if k.lower() not in excluded_headers
}


headers["X-Request-Id"] = request_id
Expand Down