我知道这不是 FastAPI 问题,但如何使用 FastAPI 避免这种情况?
例如:
from fastapi import FastAPI
app = FastAPI()
@app.get('/')
async def root(q: str):
return {"message": f"{q}"}
Run Code Online (Sandbox Code Playgroud)
发出以下请求:
http://127.0.0.1:8000/?q=1+1
Run Code Online (Sandbox Code Playgroud)
返回:
{"message":"1 1"}
Run Code Online (Sandbox Code Playgroud)