为什么我的XHR的statusText为空? [英] Why is the statusText of my XHR empty?
问题描述
当我在生产系统上执行XHR时,响应中的 statusText
将是一个空字符串。但是,在我们的开发系统中, statusText
将正确反映状态。
When I perform an XHR on our production system, the statusText
in the response will be an empty string. However, on our development system, the statusText
will reflect the status correctly.
根据 XMLHttpRequest.statusText
,在处理请求时,它应该只为空。但是,我在 onload
处理程序中看到此行为。
According to the documentation for XMLHttpRequest.statusText
, it should only be empty while the request is being processed. However, I am seeing this behavior in the onload
handler.
此外,只能在Chrome中观察到此行为和边缘。 Firefox将显示正确的文本。
Additionally, this behavior can only be observed in Chrome and Edge. Firefox will display the correct text.
那么, statusText
的内容实际上是如何确定的?
So, how is the content of the statusText
actually determined?
推荐答案
这可能是因为一台服务器使用HTTP / 2,而另一台服务器没有。 HTTP / 2不再有原因短语。
It might be because one server uses HTTP/2, while the other does not. HTTP/2 doesn't have reason phrases anymore.
这篇关于为什么我的XHR的statusText为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!