kenton-li commited on
Commit
07afc08
1 Parent(s): 30f3e0c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -1
main.py CHANGED
@@ -1,9 +1,10 @@
1
  from fastapi import FastAPI, Request
2
  from fastapi.responses import JSONResponse
 
3
 
4
  app = FastAPI()
5
 
6
- @app.all("/{path:path}")
7
  async def proxy(request: Request, path: str):
8
  async with httpx.AsyncClient() as client:
9
  # 使用相同的方法和路径参数发出请求
 
1
  from fastapi import FastAPI, Request
2
  from fastapi.responses import JSONResponse
3
+ import httpx
4
 
5
  app = FastAPI()
6
 
7
+ @app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"])
8
  async def proxy(request: Request, path: str):
9
  async with httpx.AsyncClient() as client:
10
  # 使用相同的方法和路径参数发出请求