What HTTP status response code should I use if the request is missing a required parameter?

后端 未结 9 1977
心在旅途
心在旅途 2020-11-28 01:15

I am thinking 412 (Precondition Failed) but there may be a better standard?

9条回答
  •  不知归路
    2020-11-28 01:21

    You can send a 400 Bad Request code. It's one of the more general-purpose 4xx status codes, so you can use it to mean what you intend: the client is sending a request that's missing information/parameters that your application requires in order to process it correctly.

提交回复
热议问题