@app.post("/posts")
def post_req(payload: dict = Body(...)):
print(payload)
return {"Message": "Posted!!!"}
I am using the above path operation function to receive POST requests, but when I am trying to make a request using Postman, it says value is not a valid dict
.
In Postman I am sending the below in the request body:
{
"title" : "This is title"
}
The response I get in Postman is as follows:
{
"detail": [
{
"loc": [
"body"
],
"msg": "value is not a valid dict",
"type": "type_error.dict"
}
]
}
VS Code terminal (server side) is showing this:
127.0.0.1:51397 - "POST /posts HTTP/1.1" 422 Unprocessable Entity