HTTP 303是否可以接受其他HTTP方法? [英] Is HTTP 303 acceptable for other HTTP methods?
问题描述
RESTful Web Services 鼓励使用 HTTP 303 将客户端重定向到资源的规范表示。它只讨论 HTTP GET
上下文中的主题。
RESTful Web Services encourages the use of HTTP 303 to redirect clients to the canonical representation of a resource. It only discusses topic in the context of HTTP GET
.
这是否也适用于其他HTTP方法?如果客户端尝试 HTTP PUT
或 DELETE
到非规范URI,是否可接受(和/或推荐) )返回HTTP 303?什么是最佳实践?为什么?
Does this apply to other HTTP methods as well? If a client attempts a HTTP PUT
or DELETE
to a non-canonical URI, is it acceptable (and/or recommended) to return HTTP 303? What is the best practice and why?
推荐答案
此状态代码通常适用于任何HTTP方法。它主要用于允许POST操作的输出将用户代理重定向到选定的资源,因为这样做提供了与POST响应相对应的信息,其形式可以单独识别,添加书签和缓存,与原始内容无关请求。
This status code is generally applicable to any HTTP method. It is primarily used to allow the output of a POST action to redirect the user agent to a selected resource, since doing so provides the information corresponding to the POST response in a form that can be separately identified, bookmarked, and cached independent of the original request.
来源: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section -7.4.4
这篇关于HTTP 303是否可以接受其他HTTP方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!