sachin commited on
Commit
89878fd
·
1 Parent(s): bdaab43

rever-proxed

Browse files
Files changed (1) hide show
  1. src/server/main.py +4 -14
src/server/main.py CHANGED
@@ -1,5 +1,5 @@
1
  from fastapi import FastAPI, Request, HTTPException
2
- from fastapi.responses import StreamingResponse
3
  import httpx
4
 
5
  # FastAPI app setup
@@ -44,19 +44,9 @@ async def proxy(request: Request, path: str):
44
  follow_redirects=False
45
  )
46
 
47
- # Handle streaming responses (e.g., for audio endpoints)
48
- if response.is_streamed:
49
- return StreamingResponse(
50
- response.aiter_raw(),
51
- status_code=response.status_code,
52
- headers=dict(response.headers),
53
- media_type=response.headers.get("content-type", "application/octet-stream")
54
- )
55
-
56
- # Handle non-streaming responses
57
- content = response.content
58
- return StreamingResponse(
59
- content=iter([content]),
60
  status_code=response.status_code,
61
  headers=dict(response.headers),
62
  media_type=response.headers.get("content-type", "application/json")
 
1
  from fastapi import FastAPI, Request, HTTPException
2
+ from fastapi.responses import Response
3
  import httpx
4
 
5
  # FastAPI app setup
 
44
  follow_redirects=False
45
  )
46
 
47
+ # Return the response directly
48
+ return Response(
49
+ content=response.content,
 
 
 
 
 
 
 
 
 
 
50
  status_code=response.status_code,
51
  headers=dict(response.headers),
52
  media_type=response.headers.get("content-type", "application/json")