HTTP状态代码可以具有小数值吗?
在.NET Core WebAPI中,是否可以选择使用小数示例401.2、401.3等引入HTTP状态代码,例如在IIS中进行的方式?
使用小数为小数的HTTP状态代码是更好的练习吗?如果不是这样,为什么在IIS中引入它?
In .net core webapi, is there option to introduce HTTP status code with decimals example 401.2, 401.3 etc., like how it is been done in IIS?
Is it better practice to have HTTP status code with decimals? if it is not, why it is been introduced in IIS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最新的HTTP规范(RFC 9110)说
因此,否 - 具有小数值的状态代码是 无效的。
状态代码为整数的约束可以追溯到RFC 1945(1996)
正如较早的一个问题所讨论的那样:
The most recent HTTP specification (RFC 9110) says
So, no - a status code with a decimal value is not valid.
The constraint that status codes be integers dates back to RFC 1945 (1996)
As discussed in an earlier question: