|
@@ -24,14 +24,17 @@ def sync_fetch(method, url, params=None, headers=None, data=None):
|
|
|
return Response(
|
|
|
content=response.content,
|
|
|
status_code=response.status_code,
|
|
|
- headers=dict(response.headers)
|
|
|
+ headers = { # 可以选择性透传部分 Header
|
|
|
+ key: value for key, value in response.headers.items()
|
|
|
+ if key.lower() not in ["transfer-encoding", "content-length"]
|
|
|
+ }
|
|
|
)
|
|
|
except Exception as e:
|
|
|
|
|
|
traceback.print_exc()
|
|
|
raise Exception(f"Requests error: {str(e)}")
|
|
|
|
|
|
-@router.api_route("/skwhp/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH"])
|
|
|
+@router.api_route("/skwhp/{path:path}")
|
|
|
async def proxy(request: Request, path: str):
|
|
|
target_url = f"{TARGET_BASE_URL}/{path}"
|
|
|
method = request.method.lower()
|