fixed non-streaming responses

This commit is contained in:
GitHappens2Me
2025-05-29 19:42:49 +02:00
parent 7f578cb980
commit 559fcbf3b9
2 changed files with 11 additions and 4 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ wallet.sqlite3
# Development
.notes
.keys.db
.wallet.sqlite3
.models.json
.*keys.db
.*wallet.sqlite3
.*models.json
compose.override.yml
+8 -1
View File
@@ -189,10 +189,17 @@ async def proxy(
key, response_json, session
)
response_json["cost"] = cost_data
response_headers = dict(response.headers)
# Remove Transfer-Encoding header to avoid conflict with Content-Length header in common nginx setups
if "transfer-encoding" in response_headers:
del response_headers["transfer-encoding"]
return Response(
content=json.dumps(response_json).encode(),
status_code=response.status_code,
headers=dict(response.headers),
headers=response_headers,
media_type="application/json",
)
except json.JSONDecodeError as e: