Spaces:
Sleeping
Sleeping
update
Browse files- proxyserver-fastapi.py +1 -0
proxyserver-fastapi.py
CHANGED
|
@@ -82,6 +82,7 @@ async def proxy_request(url_path: str, request: Request):
|
|
| 82 |
# 转发原始请求的头部,排除 'Host' 头部以避免冲突
|
| 83 |
# FastAPI 的 request.headers 是不可变的,需要转换为字典
|
| 84 |
headers = {key: value for key, value in request.headers.items() if key.lower() != 'host'}
|
|
|
|
| 85 |
|
| 86 |
# 将检索到的第三方API密钥添加到目标API的请求头中
|
| 87 |
headers["Authorization"] = f"Bearer {third_party_api_key}"
|
|
|
|
| 82 |
# 转发原始请求的头部,排除 'Host' 头部以避免冲突
|
| 83 |
# FastAPI 的 request.headers 是不可变的,需要转换为字典
|
| 84 |
headers = {key: value for key, value in request.headers.items() if key.lower() != 'host'}
|
| 85 |
+
headers["User-Agent"] = "PostmanRuntime/7.45.0"
|
| 86 |
|
| 87 |
# 将检索到的第三方API密钥添加到目标API的请求头中
|
| 88 |
headers["Authorization"] = f"Bearer {third_party_api_key}"
|