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

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

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

9条回答
  •  盖世英雄少女心
    2020-11-28 01:43

    I'm not sure there's a set standard, but I would have used 400 Bad Request, which the latest HTTP spec (from 2014) documents as follows:

    6.5.1. 400 Bad Request

    The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

提交回复
热议问题