Message body on a 404 message

2019-03-18 04:17发布

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.

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 :)

标签: rest
1条回答
欢心
2楼-- · 2019-03-18 04:54

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.

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

If you look at the description of 400 errors in the HTTPbis spec you will see

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

查看更多
登录 后发表回答