When is it appropriate to respond with a HTTP 412 error?

前端 未结 3 1329
不思量自难忘°
不思量自难忘° 2020-12-01 17:33

It is unclear to me when you should and should not return a HTTP 412: Precondition Failed, error for a web service? I am thinking of using it when validating data. For exa

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 18:33

    412 is reserved for cases where the request is conditional, and the condition isn't met.

    For your use case, 422 Unprocessable Entity is a good match.

提交回复
热议问题