404 消息上的消息正文 [英] Message body on a 404 message

查看:40
本文介绍了404 消息上的消息正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与一位同事交谈,他出于某种原因从头开始编写了一个框架,只是因为它无法自动解组 404 HTTP 数据包上的消息正文.

I was talking with a co-worker that for some reason wrote a framework from the ground up just because it wasn't able to automatically unmarshall a message body on a 404 HTTP Packet.

他说他遵循 REST 原则.我的猜测是 404 HTTP 数据包上的消息正文违反了这些原则,但我不确定.

He says that he's following REST principles. My guess is that a message body on a 404 HTTP Packet violate those principles, but I'm not sure of it.

如果有人对此有意见,请回答:)

If someone has a opinion regarding this, please answer :)

推荐答案

如果您使用网络浏览器访问 http://www.google.com/unknown 您将获得 404 状态代码和实体正文.

If you use a web browser to go to http://www.google.com/unknown You will get a 404 status code and an entity body.

实体主体返回 404 是很常见的.

It is quite common for entity bodies to be returned with 404s.

如果您查看 HTTPbis 规范中对 400 错误的描述你会看到

服务器应该包括一个包含一个
的表示错误情况的解释,以及是临时的还是
永久状态.

the server SHOULD include a representation containing an
explanation of the error situation, and whether it is a temporary or
permanent condition.

这篇关于404 消息上的消息正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆