javascript - 如何从客户端javascript(而不是Nodejs)发送分块的HTTP请求?
问题描述
我找不到任何方法来启动和管理来自客户端 javascript 的分块请求(无论是浏览器还是 React Native)。
相反,Node.js 提供了 http 模块,您可以使用它write()
逐步执行相同的任务和请求正文。
我的问题:是否有从客户端 javascript 发起分块 HTTP 请求?
注意:该问题与接收分块响应无关。我想发送一个分块请求。
例子:
var http = new XMLHttpRequest();
var url = 'some_url';
var body = 'The whole body data';
http.open('POST', url, true);
// Whatever the content type
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
// The whole data has to be ready and sent at once.
// How to stream the body? send it in chunks?
http.send(body);
解决方案
我建议你通过下面的链接它可能会帮助你 https://gist.github.com/CMCDragonkai/6bfade6431e9ffb7fe88 在此处输入链接描述
希望这能清除你!
推荐阅读
- python-3.x - 在 Python scikit learn 中为 12 个随机森林创建循环
- amazon-web-services - 如何使用 Docker 在 Airflow 中使用 .env 变量设置 S3 连接?
- informatica - SUBSTR 在 informatica 中
- sql - 按顺序加入 2 个表
- java - Java:澄清“长期选择的争论”场景
- email - 当谷歌表格中的字符串匹配时如何使用谷歌应用程序脚本发送电子邮件警报(单元格更改未编辑)
- reactjs - 如何管理多个下拉菜单的状态
- javascript - 在 React 组件中重置值
- visual-studio - VS Xamarin 无法生成 IPA 文件
- c# - 生成一个类的所有对象的列表