-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a bug in the single body pass parameter? #11586
Comments
422 |
import requests host = "http://localhost:8000" body = {"name": "aaa"} response = requests.post(url, json="aaa") this is correct. but why? |
In fact, such a modification can be very problematic, as there are inconsistencies in calling the method when there is only one body and multiple bodies |
If you want to be able to only take one input parameter, you can do the following: from fastapi import FastAPI, Body
import uvicorn
from typing import Annotated
app = FastAPI()
@app.post("/")
async def index(name: Annotated[str, Body(embed=True)]):
return f"hello {name}"
uvicorn.run(app) For a reference to the
|
thank you. It work |
Privileged issue
Issue Content
server
client
It's OK.
server
client
OK again.
server
client
ok. No problem.
But!!!!
server
client
It's failed. why??? very confuse!!!
How should I call it, or where can I get knowledge about it. will the next version of fastapi be able to support this call?
help me thank you very much!
The text was updated successfully, but these errors were encountered: