Skip to content

Bad request is returning 500 status code instead of 400 #1208

Closed
@MrRace

Description

@MrRace
  1. When post a bad request that should be a json, how can I define the response for the client? It seems just reply "500 Internal Server Error" now. When the client post a request that is not json format, how can I tell the client with the response?
  2. If I do not set the -H "Content-Type: application/json", but the request data is standard json format, the payload in the server is empty. I just print the payload in the predict :
        print("payload type=", type(payload))
        print("payload=", payload)

the print result are below:

payload type= starlette.datastructures.FormData
payload= FormData([]) # it is empty, why?

why the body get by the server is empty?
Thanks a lot!

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions