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

前端 未结 4 943
無奈伤痛
無奈伤痛 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:01

    I believe the determination of the correct endpoint is the sole responsibility of the REST client. (Of course, an endpoint resolution service could be easily implemented.) A 404 error just means that this particular endpoint doesn't host that particular entity.

    Nothing in RESTful design requires a server to know if a client is interacting with the "correct" host.

提交回复
热议问题