在 POST 后执行 303 重定向时,RFC 2616提到在响应正文中添加超链接(即 POST 的 303 响应正文,而不是后续 GET 对新创建资源的响应)。
10.3.4 303 See Other
The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable.
The different URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).
我有两个问题:
是否有任何实现(浏览器或其他)在 303 的正文中使用此类链接?
如果在正文中添加链接,最合适的链接关系是什么?
rel="self"
,rel="alternate"
?两者似乎都不合适。我意识到对于这样的事情可能没有标准的链接关系,如果是这样的话,那就这样吧。
最佳答案
1) 我相信所有常见的浏览器都会显示 POST->303 的响应,尽管 GET 可能不是这种情况(参见 http://greenbytes.de/tech/tc/httpredirects/#t303body)
关于web-services - 303 响应正文中的超链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12042376/