如果没有正文,4x错误的内容类型应该是什么? [英] What should the Content-Type be for a 4xx error without a body?
本文介绍了如果没有正文,4x错误的内容类型应该是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑获得以下响应的HTTP请求:
Consider an HTTP request that gets the following response:
405 Method Not Allowed
Content-Length: 0
这样的内容类型应该是什么?
What should the content-type of something like this be?
- 设置为空?
- 未设置?
- 设置为
text / plain
或text / html
- Set to nothing?
- Not set?
- Set to
text/plain
ortext/html
推荐答案
您没有任何内容,因此我根本不会设置 Content-Type
。如果你发现这会给客户带来问题(这似乎不太可能,说实话),我可能会选择 text / plain
- 绝对不是 text / html
,因为您的空内容不是 HTML文档。
You haven't got any content, therefore I wouldn't set a Content-Type
at all. If you find that causes problems to clients (which seems unlikely, to be honest), I'd probably go with text/plain
- definitely not text/html
, as your "empty content" is not an HTML document.
这篇关于如果没有正文,4x错误的内容类型应该是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文