How to distinguish 404 between entity doesn't exist and incorrect endpoint?

前端 未结 4 952
無奈伤痛
無奈伤痛 2021-01-02 00:34

Using REST principles, 404 seems to be used to indicate that an entity does not exist. However, how can clients distinguish this case from hitting an incorrect endpoint alt

4条回答
  •  遥遥无期
    2021-01-02 01:14

    According to Wikipedia HTTP status codes page

    400 Bad Request

    The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing)

    I personally stick to this - you, the client, made a bad request, and you should feel bad about this =)

提交回复
热议问题