Why is the statusText of my XHR empty?(为什么我的 XHR 的 statusText 是空的?)
问题描述
当我在我们的生产系统上执行 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<的文档/code>,它只能在处理请求时为空.但是,我在 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 和 Edge 中观察到.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 是空的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么我的 XHR 的 statusText 是空的?
基础教程推荐
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
