Http2协议和状态消息 [英] Http2 protocol and status messages

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

问题描述

因此,我只是很难理解http2协议不支持旧的http1.1协议中的404 Not Found 之类的http状态消息. 我们的网络Api之一正在使用http状态消息向终端用户返回可读消息.

So i just found out the hard way that the http2 protocol does not support http status messages like 404 Not Found in the old http1.1 protocol. One of our web Api's is using the http status message to return a readable message to the end user.

现在我的问题是,是否有一种新的方法可以在http2中返回状态消息,还是必须在http响应正文中返回该消息?

Now my question is, is there a new way of returning status messages in http2 or do we have to return the message in the http response body?

推荐答案

没有新的标准方法,因此,自定义响应标头或消息正文是您唯一的选择.

There is no new standard way, thus either a custom response header or the message body are your only choices.

(记录:我反对这一变更)

(For the record: I argued against this change)

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

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