HTTP-DELETE-请求是否允许响应正文?
我假设响应代码 200 始终允许响应主体,但我找不到任何明确提及删除请求的响应主体。
I assume the response code 200 always allows for a response-body, but I can't find any explicit mention of response-bodies for DELETE-requests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
RFC 中明确提到了这
一点答案是:
如果您返回200,您应该包含一个响应正文,其中包含描述已删除项目/资源的实体。
202 类似于异步请求/响应返回状态。
204 明确表示您不包含响应正文
It is explicitly mentioned here in the RFC
The short answer is:
You should include a response body with an entity describing the deleted item/resource if you return 200.
202 is something like an asynchronous request/response return status.
204 says explicitly that you do not include a response body
是的,根据W3C 规范:
Yes, you should usually respond with a 200 response code as per the W3C spec: