Status code for "already exist"
类似于HTTP状态代码500 - 内部服务器错误,200 - 确定,201创建等...有没有任何代码“已经存在”作为服务器响应者,尝试创建一个新的对象(如果对象相同的值存在)??
If your client sends an If-None-Match
-header like described here:
The meaning of "If-None-Match: *" is that the method MUST NOT be performed if the representation selected by the origin server [...] exists, and SHOULD be performed if the representation does not exist
Then if the same resource exists, you can respond with a 412 Precondition Failed:
if "*" is given and any current entity exists for that resource, then the server MUST NOT perform the requested method, unless required to do so because the resource's modification date fails to match that supplied in an If-Modified-Since header field in the request. [...] the server MUST respond with a status of 412 (Precondition Failed).
Instead of * (which means "if anything exists") you can also use an Etag, which basically is a checksum of the entity that is calculated by the server. You can detect identical entities by identical Etags.
链接地址: http://www.djcxy.com/p/45408.html上一篇: HTTP重定向代码之间的区别
下一篇: “已存在”状态码