My POST using FastAPI Request Form:
Request Body | application/x-www-form-urlencoded
I am trying to post,
@menu.post("/add-menu")
async def addmenu(
ItemName: str = Form(...),
ItemShortDesc: str = Form(...),
ItemPrice: str = Form(...),
ItemCategory: list = Form(...),
ItemStatus: str = Form(...),
ItemChoices: list[dict[str,str]] = Form(...)):
return ItemChoices
I got below error
Code 422 | Error: Unprocessable Entity
"detail": [
{
"loc": [
"body",
"ItemChoices",
0
],
"msg": "value is not a valid dict",
"type": "type_error.dict"
}
]
}
How can I use "dict" or "list" of "dict" in FastAPI request form? Please help me out of any possible chance.