Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -133,23 +133,17 @@ async def proxy_to_node(
|
|
133 |
f"Total setup time before streaming: {time.time() - start_time:.4f} seconds"
|
134 |
)
|
135 |
|
136 |
-
req = client.build_request(
|
137 |
r = await client.send(req)
|
138 |
print(f"Time to prepare request: {time.time() - start_time:.4f} seconds")
|
139 |
|
140 |
print(f"\nHeaders: {r.headers}\n")
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
# new_headers["Transfer-Encoding"] = "chunked"
|
149 |
-
body = await r.body()
|
150 |
-
|
151 |
-
return Response(body, headers=r.headers)
|
152 |
-
|
153 |
|
154 |
@app.api_route(
|
155 |
"/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]
|
|
|
133 |
f"Total setup time before streaming: {time.time() - start_time:.4f} seconds"
|
134 |
)
|
135 |
|
136 |
+
req = client.build_request(request.method, httpx.URL(url), headers=headers)
|
137 |
r = await client.send(req)
|
138 |
print(f"Time to prepare request: {time.time() - start_time:.4f} seconds")
|
139 |
|
140 |
print(f"\nHeaders: {r.headers}\n")
|
141 |
|
142 |
+
return Response(
|
143 |
+
content=r.content,
|
144 |
+
status_code=r.status_code,
|
145 |
+
headers=dict(r.headers),
|
146 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
@app.api_route(
|
149 |
"/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]
|